Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Talmark
Novice


Joined: 22 Nov 2003
Posts: 34

PostPosted: Sat Dec 20, 2003 7:15 pm   

Genesis Coin Converter
 
This is a little script that counts your coins on a tweleve based number system. It helps when you just have a brain freeze and can't figure out how many plat 34,072 silver might be. The coins in Genesis are valued as:

12 copper = 1 silver
12 silver = 1 gold
12 gold = 1 plat

To use the converter, just put the number of coins you have and the first letter of the type they are, and then the first letter of the type you wish to convert them to. For example:

235 g p

would show:

235 gc = 19 pc 7 gc

Hope this helps someone.

Code:

#CLASS {Coin Converter}
#ONINPUT {^(%d) (?) (?)$} {
  #GAG
  #IF {%2 = "p"} {
    #IF {%3 = "p"} {#SH %1 pc = %1 pc}
    #IF {%3 = "g"} {#SH %1 pc = %eval( %1*12) gc}
    #IF {%3 = "s"} {#SH %1 pc = %eval( %1*144) sc}
    #IF {%3 = "c"} {#SH %1 pc = %eval( %1*1728) cc}
    }
  #IF {%2 = "g"} {
    #IF {%3 = "p"} {#SH %1 gc = %eval( %1/12) pc %mod( %1, 12) gc}
    #IF {%3 = "g"} {#SH %1 gc = %1 gc}
    #IF {%3 = "s"} {#SH %1 gc = %eval( %1*12) sc}
    #IF {%3 = "c"} {#SH %1 gc = %eval( %1*144) cc}
    }
  #IF {%2 = "s"} {
    #IF {%3 = "p"} {#SH %1 sc = %eval( %1/144) pc %mod( %1/12, 12) gc %mod( %1, 12) sc}
    #IF {%3 = "g"} {#SH %1 sc = %eval( %1/12) gc %mod( %1, 12) sc}
    #IF {%3 = "s"} {#SH %1 sc = %1 sc}
    #IF {%3 = "c"} {#SH %1 sc = %eval( %1*12) cc}
    }
  #IF {%2 = "c"} {
    #IF {%3 = "p"} {#SH %1 cc = %eval( %1/1728) pc %mod( %1/144, 144) gc %mod( %1/12, 12) sc %mod( %1, 12) cc}
    #IF {%3 = "g"} {#SH %1 cc = %eval( %1/144) gc %mod( %1/12, 12) sc %mod( %1, 12) cc}
    #IF {%3 = "s"} {#SH %1 cc = %eval( %1/12) sc %mod( %1, 12) cc}
    #IF {%3 = "c"} {#SH %1 cc = %1 cc}
    }
  }
#CLASS 0
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net