|
icedsun Novice
Joined: 20 Jan 2006 Posts: 45 Location: Minnesota
|
Posted: Wed Apr 12, 2006 3:45 am
Math Functions for Very Large Numbers |
Okay, this is what i'm using as my solution to the approximate 2 Billion number limit in zMUD. It's an extension of what others have posted in the past...
Code: |
#SCRIPT {function add(x,y):add=x+y:end function}
#SCRIPT {function subtract(x,y):subtract=x-y:end function}
#SCRIPT {function multiply(x,y):multiply=x*y:end function}
#SCRIPT {function divide(x,y):divide=x/y:end function}
#SCRIPT {function power(x,y):power=x^y:end function}
#SCRIPT {Function islessthan(x,y):islessthan = (x<y):End Function}
#SCRIPT {Function isgreaterthan(x,y):isgreaterthan = (x>y):End Function}
#FU add {%mss(add(%1,%2))}
#FU sub {%mss(subtract(%1,%2))}
#FU mult {%mss(multiply(%1,%2))}
#FU div {%mss(divide(%1,%2))}
#FU pow {%mss(power(%1,%2))}
#FU lt {%mss(islessthan(%1,%2))}
#FU gt {%mss(isgreaterthan(%1,%2))} |
The functions make it a little less work to implement this stuff throughout your scripts. Here's some examples of how you'd use it:
Code: |
#SHOW 2 + 30 = @add(2,30)
#SHOW 5 * 10 = @mult(5,10)
#IF (@lt(5,7)) {#SHOW Less than.} {#SHOW Not less than.} |
|
|
_________________ "Build a man a fire and he's warm for a night. Light a man on fire and he's warm for the rest of his life." --My Mom |
|
|
|
icedsun Novice
Joined: 20 Jan 2006 Posts: 45 Location: Minnesota
|
Posted: Thu Apr 13, 2006 10:28 am |
One thing... does anybody know how to make "#SCRIPT" functions save? Whenever I close the character's window, all the scripts are gone if you re-open the character. I have to add all the "#SCRIPT" commands to my login trigger so they are re-created each time. Any way to get them to stay saved?
|
|
_________________ "Build a man a fire and he's warm for a night. Light a man on fire and he's warm for the rest of his life." --My Mom |
|
|
|
|
|
|
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
|
|