Difference between revisions of "Prog Appendix 6"
From Immwiki
m |
m (link fix) |
||
Line 13: | Line 13: | ||
>verb_prog p collect | >verb_prog p collect | ||
− | if isbitset($n) == | + | if isbitset($n) == shop[[OwnerBit]] |
mpset mob self copper 0 | mpset mob self copper 0 | ||
mpset mob self platinum 0 | mpset mob self platinum 0 | ||
mpset mob self gold 0 | mpset mob self gold 0 | ||
mpset mob self silver 0 | mpset mob self silver 0 | ||
− | mpat | + | mpat shop[[StorageVnum]] get all |
mpget mob $i platinum 0 | mpget mob $i platinum 0 | ||
mpget mob $i gold 1 | mpget mob $i gold 1 | ||
Line 64: | Line 64: | ||
>verb_prog p buy | >verb_prog p buy | ||
− | if isbitset($n) == | + | if isbitset($n) == shop[[OwnerBit]] |
mpinterpret $n $x | mpinterpret $n $x | ||
mpget mob $i platinum 0 | mpget mob $i platinum 0 | ||
Line 83: | Line 83: | ||
mpget mob $i silver 2 | mpget mob $i silver 2 | ||
mpget mob $i copper 3 | mpget mob $i copper 3 | ||
− | mpat | + | mpat shop[[StorageVnum]] drop \$0 platinum |
− | mpat | + | mpat shop[[StorageVnum]] drop \$1 gold |
− | mpat | + | mpat shop[[StorageVnum]] drop \$2 silver |
− | mpat | + | mpat shop[[StorageVnum]] drop \$3 copper |
endif | endif |
Revision as of 21:35, 26 April 2011
Appendix 6: Generic Prog Skeletons
In this section, we will include generic versions of whole progs, to be cannibalized and adapted for future use. Make the parts that need to be changed obvious!
Collected progs for making a player-owned shop, with profit-sharing and optional comped goods
Requirements are: 1 shopkeeper mobile (requires act keepgold), 1 room flagged save, nowhere, nosum_to, nosum_from, and nogate, and 1 free bit. Progs go on the mob.
>load_prog 100 speak common
This mob talks, so include this if it's not a human.
>verb_prog p collect if isbitset($n) == shopOwnerBit mpset mob self copper 0 mpset mob self platinum 0 mpset mob self gold 0 mpset mob self silver 0 mpat shopStorageVnum get all mpget mob $i platinum 0 mpget mob $i gold 1 mpget mob $i silver 2 mpget mob $i copper 3 if value(0) > 0 or value(1) > 0 or value(2) > 0 or value(3) > 0 say Your portion of the profits, sir. emote passes a small bag to $N. //above is the flavour section of the cash handoff-- you will want to write your own. mpmath 4 \$3 + 10*\$2 + 100*\$1 + 1000*\$0 mpmath 5 (\$4*2)/5 //the above line is the one where owner return rate is determined. //do decimals via fractions. Example shown gives a 40% return-- //use that number as-is unless you have a reason to do otherwise. mpmath 6 \$5/1000 mpmath 5 \$5 - \$6*1000 mpmath 7 \$5/100 mpmath 5 \$5 - \$7*100 mpmath 8 \$5/10 mpmath 5 \$5 - \$8*10 mpset mob self copper \$5 mpset mob self platinum \$6 mpset mob self gold \$7 mpset mob self silver \$8 give \$5 copper $n give \$8 silver $n give \$7 gold $n give \$6 platinum $n note to immortal note subject $N collected $s filthy, filthy lucre. note + I passed off \$6 platinum, \$7 gold, \$8 silver, and \$5 copper. note send else say I apologize, sir, but there hasn't been enough business, since you were by last. //flavour for no money in the storage room; again, write your own. endif else emote pointedly ignores $N. //you ain't the boss of me-- and the same. endif
>verb_prog p buy if isbitset($n) == shopOwnerBit mpinterpret $n $x mpget mob $i platinum 0 mpget mob $i gold 1 mpget mob $i silver 2 mpget mob $i copper 3 give \$0 platinum $n give \$1 gold $n give \$2 silver $n give \$3 copper $n tell $n Your money is no good here, sir. else //the above section can be removed for a shop that doesn't comp purchases, or math can be done to provide //a discount rather than comping, if you study the math in 'collect' above. mpinterpret $n $x mpget mob $i platinum 0 mpget mob $i gold 1 mpget mob $i silver 2 mpget mob $i copper 3 mpat shopStorageVnum drop \$0 platinum mpat shopStorageVnum drop \$1 gold mpat shopStorageVnum drop \$2 silver mpat shopStorageVnum drop \$3 copper endif