Jump to content
  • 0

Script Overflowed


Question

Posted

This only happens rarely, but still annoying to see error in console :[

Here is the script:

- script ROTD -,{
end;
OnClock0000:
OnInit:
setarray .ROTD$[0], "Formless", "Undead", "Brute", "Plant", "Insect", "Fish", "Demon", "Demi-Human", "Angel", "Dragon";
set .Race, rand(9);
set .BonusEXP, rand(15,30);
set .ExpLvlRange, 10;
announce "Players will get " + .BonusEXP + "% bonus EXP from hunting " + .ROTD$[.Race] + " monsters today!",0;
end;
OnNPCKillEvent:
if (getmonsterinfo(killedrid,19) != .Race) end;
if (getcharid(1)) {
 set .@Location$, strcharinfo(3);
 set .BaseLvl, BaseLevel;
 getpartymember getcharid(1),1;
 getpartymember getcharid(1),2;
 for (set .@a, 0; .@a < .partymembercount; set .@a, .@a + 1)
  if (isloggedin(.partymemberaid[.@a]))
   attachrid (.partymemberaid[.@a]);
  if (strcharinfo(3) == .Location$ && ( .BaseLevel - BaseLevel) <= .ExpLvlRange)
   getexp (getmonsterinfo(killedrid,3) * .BonusEXP / 100), (getmonsterinfo(killedrid,4) * .BonusEXP/100);
} else {
 getexp (getmonsterinfo(killedrid,3) * .BonusEXP / 100), (getmonsterinfo(killedrid,4) * .BonusEXP/100);
}
end;
OnPCLoginEvent:
dispbottom "Players will get " + .BonusEXP + "% bonus EXP from hunting " + $mobrace$ + " monsters today!";
end;
}

Error output:




[Warning]: script:op_2num: overflow detected op=C_MUL i1=625000000 i2=26
[Debug]: Source (NPC): ROTD (invisible/not on a map)



4 answers to this question

Recommended Posts

Posted

The only line that can overflow is this one:

getexp (getmonsterinfo(killedrid,3) * .BonusEXP / 100), (getmonsterinfo(killedrid,4) * .BonusEXP/100);

getexp multiplies parameters by the quest_exp_rate setting, so that's probably where you're getting the huge numbers. Try rand(2,3) instead of rand(15,30); it'll save a power of ten, and is close enough.

Posted (edited)

not sure but try () to change calculate order maybe another solution

getexp (getmonsterinfo(killedrid,3) * .(BonusEXP / 100)), (getmonsterinfo(killedrid,4) * (.BonusEXP/100));

*Athena not supoorting Calculating Float.

Edited by QQfoolsorellina

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...