Find
You are in a shop keeper
Created by
omenofdoom
, last updated 01 Aug 2015
Code
##sell:runsub sellchk;
##sellchk:
if $second eq $actor then sellit else end;
##sellit:
set $target's loc to $actor;
set $target's extra to 'soldtome';
set $target's pose to '';
var $aworth to $init_obj's worth;
var $tworth to $target's worth;
add $tworth to $aworth;
set $init_obj's worth to $aworth;
msg $loc,$actor,0,0,'say',"[$actor] buys [$target] from [$init_obj] for $tworth $coinage";
rem look $loc;
msg $loc,$init_obj,$init_obj,0,'force',"force:look $loc";
##buyfail:runsub chkitsme;
##chkitsme:
if $second eq $actor then listitems else fail;
##buy:runsub buychk;
##buychk:
if $second eq $actor then buyitemchk else end1;
##end1:msg $loc,$actor,0,0,'think',". o 0 ( what is [$second] trading? ) ";
##tickloc:
runsub randomechatter;
##tickhour2:
runsub replenish;
##randomechatter:
set $actor's pose to 'looking like he`d rather be somewhere other than';
runsub introitems/10;
##talk:runsub talkchk;
##talkchk:
if $target eq $actor then introitems else nottalkingtome;
##buyitemchk:
if $target's loc eq $actor then buychkworth else introitems;
##introitems:msg $loc,$actor,0,0,'say',"[$actor] says 'If you're going to buy something, hurry up and buy it. I may have all day, but I certainly don't want you to take all day!'";
runsub listitems;
##replenish:
foreach in $actor do checkit not doorway not player;
##checkit:
if $for_id's extra = 'soldtome' then cantreplen else replenishit;
##replenishit:
find $loc,76666;
set $for_id's qty to 500;
print "[$actor] rummages through [$found_id], grabbing more items for customers";
##listitems:
var $click_cmd to "buy";
var $click_mid to "from $actor";
var $desc_intro to '
Items for sale:
';
rem look $actor,trade;
msg $loc,$init_obj,$init_obj,0,'force',"force:look $actor,trade,worth>0";
##buychkworth:
var $aworth to $init_obj's worth;
var $tworth to $target's worth;
if $aworth > $tworth then buyit else buynocando;
##buyit:
set $target's loc to $init_obj;
take $tworth from $aworth;
set $init_obj's worth to $aworth;
msg $loc,$actor,0,0,'say',"[$init_obj] buys [$target] for $tworth $coinage from [$actor]";
rem look $loc;
msg $loc,$init_obj,$init_obj,0,'force',"force:look $loc";
##buynocando:
say 'say',"[$init_obj] can not afford [$target]";
a lethal blade soldtome