Jump to content
  • 0

Overflow detected! Banker script


Question

10 answers to this question

Recommended Posts

Posted (edited)

The error itself in english:

Warning. Overflow detected when using addition on the two values, 2147483647 and 21474836.

As Wikipedia explains overflow:

Arithmetic overflow, a condition that occurs when a calculation produces a result that is greater than what a given register can store or represent

With the first value being the greatest positive value a signed integer can store, the result of the addition is greater then what a signed integer can store.

My guess is that when the script calculates the interest, it doesn't check if the value will overflow or not.

I don't remember how the emulator works with overflowing values, but do you get a negative bank value if you deposit more money?

Edited by plankt
Posted

The error itself in english:

Warning. Overflow detected when using addition on the two values, 2147483647 and 21474836.

As Wikipedia explains overflow:

Arithmetic overflow, a condition that occurs when a calculation produces a result that is greater than what a given register can store or represent

With the first value being the greatest positive value a signed integer can store, the result of the addition is greater then what a signed integer can store.

My guess is that when the script calculates the interest, it doesn't check if the value will overflow or not.

I don't remember how the emulator works with overflowing values, but do you get a neegative bank value if you dposit more money?

Thanks for the reply, unfortunately, i cannot test it because whenever i want to deposit or withdraw money, the NPC will stuck

BUMP! Can someone fix this script and error for me?

Posted

yes it can.... up to INT_MAX(2147483647) however your script doesn't check if the variable is going to be over the max value when the interest is added....

therefore you must add the max checking....

Posted

yes it can.... up to INT_MAX(2147483647) however your script doesn't check if the variable is going to be over the max value when the interest is added....

therefore you must add the max checking....

how can i exactly add this checking? can you modify the script for me?

Posted

oh...yeah..it must be

if(  (#3rdbank+@int) > 2147483647 )
	 set #3rdbank, 2147483647;

just add before the adding and skip the adding when this is set to true...

thanks Euphy....

oh...yeah..it must be

if(  (#3rdbank+@int) > 2147483647 )
	 set #3rdbank, 2147483647;

just add before the adding and skip the adding when this is set to true...

thanks Euphy....

Which part of script do I need to add this exactly?

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...