Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Item = variable

10 years ago

So ... how do I script this: If you're holding a specific item, a variable is automatically changed to / increased by / decreased by a specific value.

Item = variable

10 years ago

If you want it to be a one time bonus then:

IF %ITEMSTATE(item number) = 1

THEN %VALUE := %VALUE + 1

This goes in your global script. If you want it to be an every page bonus, put in in link scripts. If you want it to give  a bonus on a specific page, put it on the page script of that page.

Item = variable

10 years ago

Why?

You can (for the most part) already use items as variables anyway.

Item = variable

10 years ago

I'm assuming you only want this to happen once. If so, for example, whenever you are holding a sword, you want the hero's strength to be increased by 10, but only once, you would use this code in the global page script:

IF $ITEMSTATE1 = 1 THEN

IF %ICE = 0 THEN

BEGIN

%ICE := 1

%STRENGTH := %STRENGTH + 10

END

Item = variable

10 years ago

I've tried putting in the script both ways shown in your respective comments, you guys, and it's not working.I also tried just doing it on that one page instead of putting it in global scripting. I'm checking the variable on the page and it's not changing at all. =\  Any ideas as to what I'm doing wrong?

@betaband @nmelssx

Item = variable

10 years ago
Can I see your codes?

Item = variable

10 years ago
^second.