Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Increase/Decrease Links

18 years ago
Is there any way I can make it so every link you click, a variable (in my case) decreases by 1, or even better, if it decreased by 1 after every three or so links?

Increase/Decrease Links

18 years ago
Scripting.  I thhink theres a way.

Increase/Decrease Links

18 years ago
That's what I meant.. thanks for telling me anyways.

Increase/Decrease Links

18 years ago

In the Advanced Editor, go to the Scripts section. You will see a list of all scripts currently in your game. At the top, you will see Global Link and Global Page.

If you want something to happen when EVERY link is clicked, you open up Global Link and write a script there.

For example, adding to the same variable every time a link is pressed.

%VARIABLE := %VARIABLE + 1

If you only want it to go up every three links, all you have to do is make a second variable to act as a "counter". The "counter" variable would go up each time a link is clicked, and when it reaches three, it adds +1 to your main variable, and resets the counter to zero. So you might have a script like this instead:

%COUNTER := %COUNTER + 1

IF %COUNTER = 3 THEN
     BEGIN
          %COUNTER := 0
          %VARIABLE := VARIABLE + 1
     END

Increase/Decrease Links

18 years ago
Hey I want to make something with Hunger and every 2 turns it goes down could you type what I should put in it

Increase/Decrease Links

18 years ago
Easy enough. To enable this you'll have to put scripting on advanced. Go to the Global Link Script in the Scripts section of your storygame and write the script I'm about to tell you in.

But first, you'll need to have the variables: HUNGER and HCOUNTER (minimum is 0, maximum is 2, starting on 0).

The script is:

%HCOUNTER := %HCOUNTER + 1

IF %HCOUNTER = 2 THEN
BEGIN
   %HCOUNTER := 0
   %HUNGER := %HUNGER - 1
END


The part that says %HCOUNTER := %HCOUNTER + 1 basically means the variable HCOUNTER is set to HCOUNTER plus one. In English this would be add one to HCOUNTER. The % before a variable tells the system it is a variable.

The next part means if Hunger Counter (HCOUNTER) is equal to two, then reset it to 0, and decrease HUNGER by one.

Every time you click on a link, Hunger Counter increases by one. When it reaches to, you get more hungry and the Hunger Counter starts over again.

Increase/Decrease Links

18 years ago
nice guys, nice. Tsmpaul, you should really make an article. A scripting article on a password script, and this one. If you would like i can compile this stuff for you and publish it under your name. Either way, it should be published :)

Increase/Decrease Links

18 years ago
You don't need scripting to make a variable go up 1 every time a link is pressed.  Just go into the variable page of the link, and than you find that variable.  Make it so that it's addition and one.

Increase/Decrease Links

18 years ago
The difference is, one single script that automatically affects every single link in the game, by using a global link script, or having to individually set a variable to change every single time you create a link in your game. One takes a few seconds to do, the other you have to do constantly as you create your game.

Increase/Decrease Links

18 years ago
Yeah, I'll probably write an article or two at some point Solo, just need the time.