I am again trying to create a simpler version of a naming generator. This time I am not only using Variables but also scripts.
So I have created a single page with all the 26 letters as links. Now my idea to go with was to set a rather simple script at each link looking like this.
IF %DIGIT01 = 0 AND THEN %DIGIT01 := 1
IF %DIGIT01 > 0 AND THEN %DIGIT02 := 1
IF %DIGIT02 > 0 AND THEN %DIGIT03 := 1
IF %DIGIT03 > 0 THEN
$DEST := @P10
The DIGIT variables are the letters of the alphabeth so in this case the 1 gives an output of A. After the link is clicked you get sent to that same page again where you can again make a choice for a letter. How i thought this would work is that the script checks if DIGIT01 has a value of 0 and if that is the case replace that value with a 1 standing for A. That should normally always be the case at the beginning of the game therefore DIGIT1 gets set to 1. The problem I experienced was that the first line of the script sets the value of DIGIT1 above 0 so automatically the next line sends a 1 to DIGIT2 and the line after sends a 1 to DIGIT3.
So far so good so I thought I need to make clear that only the first time you click the button that first script part should work so I changed the script to:
IF %DIGIT01 = 0 AND %CLICKC = 1 THEN %DIGIT01 := 1
IF %DIGIT01 > 0 AND %CLICKC = 2 THEN %DIGIT02 := 1
IF %DIGIT02 > 0 AND %CLICKC = 3 THEN %DIGIT03 := 1
IF %DIGIT03 > 0 THEN
$DEST := @P10
The variable CLICKC standing for "Click Count" gets higher the more often you click the Link and it can be increased repeadedly. So now it only adds a 1 to that first letter when i click one time. The problem now however is that no matter how often i click the link to add another Letter it only increases the CLICKC variable while my letters stay at 0.
So to come to the real question. If i use a link script, does that link only run that script 1 time or is there someting else wrong?