Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Random Variables (with scripting)

18 years ago
Before I start, I think you could make an article with all I have asked on here if you grouped it all together. Thanks for the help so far, especially tsmpaul and solostrike.

Okay, I'm planning to do sort of the same thing as time, except with the weather. On every link, the WCOUNT (weather count) increases by 1. When it reaches a hundred, I want to know how to change the WEATHER variable randomly (0 and 1 is clear, 2 is cloudy, 3 is raining/snowing [depending where you are]) and the WCOUNT to reset to 0. Could somebody put this in scripting for me.. I think this is my last idea.

Random Variables (with scripting)

18 years ago

AlexP and Solostrike have written two articles that could probably help you out.

Basic Scripting Article

http://chooseyourstory.com/help/articles/article.aspx?ArticleId=45

Intermediate Scripting Article

http://chooseyourstory.com/help/articles/article.aspx?ArticleId=46

In the basic scripting article, it talks about generating random numbers using dice. Just write 1D4 to find a random number between 1 and 4.

So, if you have four types of weather, you might write:

%WEATHER := 1D4

Then all you need to do is write in the script a check to see if %WCOUNT has reached 100, and if it has, roll a die to see what the new weather is, and reset your weather counter to zero.

Random Variables (with scripting)

18 years ago
I'm going to try and use what I've learned so far to create this script.. if somebody could tell me if it is right I would appreciate it, because then I'd know I've learned some scripting skills.

%WCOUNT := %WCOUNT + 1

IF %WCOUNT = 100 THEN
    BEGIN
       %WCOUNT = 0
       %WEATHER = 1D4
    END

Random Variables (with scripting)

18 years ago
That's almost it, all you need to remember is that if you're checking if a variable equals something, you use an = sign, but if you are setting a variable to equal something, you need to use the :=

Random Variables (with scripting)

18 years ago
You know with fonts and stuff, if theres no text on the page but the hidden script text, how do you set the font?

Random Variables (with scripting)

18 years ago

Drats. I tried it out, and I thought I knew how to make that work, and the script ran without errors, but the text still did not change font on the screen when I read my test story.

You might have to ask Solostrike, or AlexP, unless anyone else knows how to script a working font change?

Random Variables (with scripting)

18 years ago
Maybe have the font already set as something when you script it in. Like have the font set to Verdana or whatever and then see if the script changes to Verdana as well.

Random Variables (with scripting)

18 years ago
nope, that doesn't work...

Random Variables (with scripting)

18 years ago

i do not think fonts and html have been included in the script, although you COULD try this:

for the $PAGETEXT variable in a page script, when writing: $PAGETEXT := "hello, this is new text", you could have:

$PAGETEXT := "<b>hello this is bold</b>"

just give it a try and lemme know if it works.

For the articles, i have created an article on random variables, however, it does not incorporate scripting as i wrote it long before scripting was introduced.

Random Variables (with scripting)

18 years ago

Most html formatting works fine. <b> </b> <u> </u> <i> </i> <br> all work. They're the only one's I've really tried using. A number of other commands don't work though. I find if the HTML command contains " " quotation marks it desn't seem to work. Ie, the HTML change font command has quotation marks on either side of the name of the font, so that doesn't work. The HTML image displaying doesn't work either, but luckily Alexp put in a script command for that.

Random Variables (with scripting)

18 years ago

if you use """ quote marks, it will not work, but i believe if you put the html code for a " mark, it will work...

Random Variables (with scripting)

18 years ago

Tried that too. You can use &#34; to display a " on the page, good for when someone is talking, but when I tried inserting &#34; into HTML commands, such as load image, or change font, it didn't work.

Random Variables (with scripting)

18 years ago
lol, i had to switch to ' single quote marks for when someone speaks...

Random Variables (with scripting)

18 years ago
Alex, could you please check this out if you read this thread?

Random Variables (with scripting)

18 years ago
As in checking out how to change font within the $PAGETEXT variable.