Jump to content
  • 0

Script Overflowed


Bin4ry

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

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)



Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1132
  • Joined:  05/27/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   105
  • Joined:  11/19/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Wait. Little confused here. If I use rand(2,3) when it divided by 100.

Poring

20 Job EXP * 2 or 3 / 100 = -40

So I should make it divide by 10 instead?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1132
  • Joined:  05/27/12
  • Last Seen:  

Yeah, 2~3 / 10 is close enough to 15~30 / 100. :>

Link to comment
Share on other sites

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.

×
×
  • Create New...