|
sprockfizzly Newbie
Joined: 06 Aug 2016 Posts: 3
|
Posted: Sat Aug 06, 2016 6:23 pm
powerlevel multiplier for dbz mud |
Im trying to make something that takes my current powerlevel and multiplies it by 9.5. I tried to modify a couple scripts ive seen on the forums but cant seem to get it to work.
In score, this is what in trying to go off of:
CURR POWERLEVEL: 50,488,307,431,678,409,602,432,675,872,768
This is what i got so far:
Trigger: CURR POWERLEVEL: (%n)
#VAR CplVar %number( %replace( "%1", ",", ",", ",", ",", ",""))
#VAR MaxGain 9.5
#MATH TarGain(CplVar*MaxGain)
#SHOW Find mobs around @TarGain powerlevel
At one point i had it telling me 0, now it tells me "Find mobs around powerlevel.
Any help would be appreciated. Its for determining the powerlevel of the mobs i need to fight to get the highest gains. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Aug 09, 2016 8:08 am |
zMud is a 32bit program and I do not think it has any facility to work with numbers larger than 4 billion. That said you can manually write the math, multiplication is rather easy.
#VAR CplVar {%replace("%1", ",", "|")}
#VAR M1 {}
#FORALL @CplVar {
M1=%additem(%eval(%i*95/10), @M1)
}
#VAR M2 {}
#VAR M3 {%numitems(@M1)
#VAR M4 {%concat("000", %item(@M1, @M3))}
#LOOP @M3 {
M2=%push(%rightback(@M4, 3) ,@M2)
#ADD M3 {-1}
M4=%leftback(@M4, 3)
#IF (@M3 > 0) {
M4=%eval(@M4 + %item(@M1, @M3)
M4=%concat("000", @M4)
}
}
M4=%eval(@M4)
#WHILE (%len(@M4) > 0) {
M2=%push(%rightback(@M4, 3)
M4=%leftback(@M4, 3)
}
TarGain=%replace(@M2, "|", ",")
#SHOW {Find mobs around @TarGain powerlevel}
The explanation is fairly simple. First I convert into a list with the replace which will make each item of the list a value in the range 0-999. I then multiply each of those values by 95 and divide by 10 to produce a 9.5 net multiplier, zMud uses integer math. I then go from the back of the list and add any part greater than 999 to the preceding element, output the lowest 3 digits, and chop off the output digits. Once I have gotten the final value for the first element I break that into 3 digit chunks and add that into the working list. Finally I replace the list separator with commas for display. I think I wrote everything correctly, but no testing was done. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
sprockfizzly Newbie
Joined: 06 Aug 2016 Posts: 3
|
Posted: Wed Aug 10, 2016 9:21 pm |
Awesome! Ill try it when i can get a minute. Quick question, does it work for lower numbers?
|
|
|
|
sprockfizzly Newbie
Joined: 06 Aug 2016 Posts: 3
|
Posted: Wed Aug 10, 2016 10:32 pm |
Tryed it. There was alot of errors. Missing )'s. When i tested it it told me:
Find mobs around 214 powerlevel
Maybe im trying to use the wring number. Instead of using the one in score. what about the prompt?
(PowerLevel:<1000.0oct|50.49non>) |
|
|
|
|
|
|
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
|
|