Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Random script help

10 years ago

I correctly set the dice in the variable list and in the link leading to the page where a random last name for a npc has to appear, but can't get the script creating it correctly

Script (which the script validation accepts without any correction)

IF %NAMEDICE = 1 THEN BEGIN %HERNAME := "Dumbette" END ELSE
BEGIN IF %NAMEDICE = 2 THEN %HERNAME := "Apronine" END
BEGIN IF %NAMEDICE = 3 THEN %HERNAME := "Saintina" END
BEGIN IF %NAMEDICE = 4 THEN %HERNAME := "Madam" END
BEGIN IF %NAMEDICE = 5 THEN %HERNAME := "Tripella" END

Next page:

Then, $HERNAME picked up the book and gave it to Marvin

Random script help

10 years ago

Just have a Link set %HERNAME to 1-5

Next page:

Then, %%HERNAME%=%1%Dumbette%%%%HERNAME%=%2%Apronine%%%%HERNAME%=%3%Saintina%%%%HERNAME%=%4%Madam%%%%HERNAME%=%5%Tripella%% picked up the book and gave it to Marvin

Random script help

10 years ago
Variables can only be numbers, so saying %HERNAME = "Name" will never work.

$ is only used for system variables. Your line should be:

Then, %%HERNAME%% picked up the book and gave it to Marvin

And even then, %HERNAME can only return a number.

You only need begin/end if there are multiple points to do, so:
IF %X = 5 THEN
BEGIN
#Do something
#Do something else
END

Your code can remove every begin and end statement used.
IF %NAMEDICE = 1 THEN %HERNAME := "Dumbette"
IF %NAMEDICE = 2 THEN %HERNAME := "Apronine"
IF %NAMEDICE = 3 THEN %HERNAME := "Saintina"
IF %NAMEDICE = 4 THEN %HERNAME := "Madam"
IF %NAMEDICE = 5 THEN %HERNAME := "Tripella"

(Although it will still be wrong because variables can't hold text)

Also, the ELSE that you have in the code serves no purpose at all.

Random script help

10 years ago

^Fixing above haha!

(Damn you're fast) XD

Random script help

10 years ago

It is still not showing anything but $HERNAME in the next page.

In the link, if I try to change THEN %HERNAME to THEN $HERNAME it throws an error when I validate it: Did not recognize '$H'. Col=25

And this is just the first word of a series of characteristics I try to randomize...

Random script help

10 years ago

As Killa mentioned above, you can't have a $ Variable (those are reserved for System Variables). You have to have %HERNAME.

If you have managed to enter $HERNAME in the Variable section, then your Variable is really named %$HERNAME.

---

Note, when adding Variables in the Editor, you dont add the % preface. You only add that in the Scripting to define what you are typing as a Variable.

Random script help

10 years ago

No, the variable is just HERNAME

Random script help

10 years ago

OK, so have the 'HERNAME' Variable set to a value of 1-5. Then on another page (after) it has been set, add the following right onto the page itself (not in the Script and not in the Source - right on the page with normal text) -

Then, %%HERNAME%=%1%Dumbette%%%%HERNAME%=%2%Apronine%%%%HERNAME%=%3%Saintina%%%%HERNAME%=%4%Madam%%%%HERNAME%=%5%Tripella%% picked up the book and gave it to Marvin

Random script help

10 years ago
Dunno why you would try to change it to use $ when I specifically said that's not what you're supposed to do...

Random script help

10 years ago

This is my first attempt eve at using any technical language. I tried everything the help said, But I can't find what I have to put in the game's second page for the scrip to change the text there.
 

Random script help

10 years ago
I'm not sure how technical the phrase "Don't use the $" is, but alright.

You put this (What Berka wrote):

%%HERNAME%=%1%Dumbette%%%%HERNAME%=%2%Apronine%%%%HERNAME%=%3%Saintina%%%%HERNAME%=%4%Madam%%%%HERNAME%=%5%Tripella%%

In the spot where you want the name to be on the actual page. So instead of:

Then, %HERNAME picked up the book and gave it to Marvin

It would be:

Then, %%HERNAME%=%1%Dumbette%%%%HERNAME%=%2%Apronine%%%%HERNAME%=%3%Saintina%%%%HERNAME%=%4%Madam%%%%HERNAME%=%5%Tripella%% picked up the book and gave it to Marvin

It doesn't look very readable, but that's how it is. When you do the randomness, set the value of HERNAME equal to whatever NAMEDICE is.

Random script help

10 years ago

Oh, I thought you could use scripts to shorten the work, and translate from numbers to words. Me stupid.

Forget I asked anything blush