Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions don't use the actual value of storage variables. #48

Closed
bobokox opened this issue Apr 8, 2018 · 2 comments
Closed

Functions don't use the actual value of storage variables. #48

bobokox opened this issue Apr 8, 2018 · 2 comments

Comments

@bobokox
Copy link

bobokox commented Apr 8, 2018

I have this function in my game:

function percent_agi(a,b){return storage.prob100 = a/b*100;}

if i execute the function in the script like this:
percent_agi(storage.c_agi, 35),

it doesn't take the actual value of storage.c_agi. It takes always the start value which stands in the script.

@Hyuchia
Copy link
Member

Hyuchia commented Apr 11, 2018

Hi there! Yes, that can be a nasty side effect of the whole JSON thing, have you tried wrapping that on another function?

Something like:

function () {
    percent_agi(storage.c_agi, 35);
},

@Hyuchia
Copy link
Member

Hyuchia commented Jul 13, 2018

Since this is not exactly a bug but an expected behavior of common functions (without wrapping) in the script, I'm closing this now. If you run into any other issues, I'll reopen it 👍

@Hyuchia Hyuchia closed this as completed Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants