Saturday, October 3, 2020

*input with optional min/max parameter

I still see a lot people do this

although this isn't bad by any means, but we can hijack it with *input <var>,<min>,<max>;


yup, just 1 line, do all 3 conditions above

No. 1 - *input script command can return -1,0,1 these 3 values
if the input amount is smaller than <min>, then it will return with the condition -1
since we don't want to close; the script on condition 0 or 1, then put the <min> as 1,
when player input as 0, it will return as condition -1

No. 2 - The <max> can insert with the condition countitem(Poring_Coin), or 100, depends on the script
Or ... just do both by having a *min script command <-- pick the lowest value in the group

DO NOT UNDERESTIMATE THIS TRICK
This is extremely useful if there is a complex +/- calculation involve
Example this custom bank script
Player only needs to input 9999999999 and it will automatically convert into accepted value without having to pull out a calculator

External Links:
Zeny in separate table

1 comment:

  1. in rAthena documentation (For numeric inputs the value is capped to the range [min,max]. Returns 1 if
    the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
    For string inputs it returns 1 if the string was longer than 'max', -1 is
    shorter than 'min' and 0 otherwise.) it return -1 or 1, so it should be like
    if (input(.@tmp, 1, min(100, countitem(Poring_Coin))) != 0) since if result having value mean undesired.

    ReplyDelete

Linux compiler error that never shown on Visual Studio

let's just admit Visual Studio sux ... ok ? right now, if you want to host a Private Ragnarok Online server, its just better to choose...