Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Can someone help me with the Variables?

10 years ago

Hi, I am fairly new to the site and am still trying to learn all the ins and outs of the items, scripting and variables.

Basically for my next story game I would like the reader to assign 9 Skill Points among 3 Skills, giving each a minimum score of 1 and a maximum score of 5. At various points in the game I would like to test these skills with a 1D6 random variable roll with the reader succeeding if the number is equal to or lower than the score they have given that particular Skill and failing if it is higher. I have succeeded in figuring out some things but I would be very grateful if someone could help me explain how to apply all of this idea, which is very simple on paper but which I find very difficult to make a reality online, so it works.

Thanks for taking the time to read this and have a good day :)

Can someone help me with the Variables?

10 years ago
Okay, to avoid just giving you the code, I am going to take the nmelssxian method and explain it to you, which is something I utterly suck at. So, bear with me.

In order for these skills to work, they need to be variables. So, create the 3 variables to represent the 3 skills. Then, create another two variables:one for the skill points and one for your dice roll later on. Do not set the value of the first three variables, but set the value of the skill points variable to 9. Then, when making your skill set page, create four links: three skill increase links and one 'continue' link. Put a restriction on the 'continue link' so that it only works when the skill points variable is set to 0 and all the other variables are at least 1. Then, set each of the skill up variables so that they only appear when skill points variable is greater than 0 and the variable of that skill is less than or equal to 5.

Okay, so for the next part, you will need to have scripting enabled. Go to the page where you want the skill event to occur and access that page's script (the := symbol near the top of the page). Here you will set value of the dice roll variable to 1D6. Then, use an if-then statement to evaluate whether the value of the dice roll is greater than or less than / equal to the relevant skill variable and take the player to the appropriate page. This can be done like:

IF %SKILL1 >= %DICEROLL THEN $DEST := @P34
IF %SKILL1 < %DICEROLL THEN $DEST := @P35

Can someone help me with the Variables?

10 years ago

I could tell you how to do it with variables, but it's more than likely scripting is easier.

Can someone help me with the Variables?

10 years ago

Thanks for your help jamescoker and Sethaniel (really enjoyed Haunted and Snow by the way), I've worked jamescoker's advice through and as far as I can tell it seems to work which is great. Do you know if there is any way for me to preview or test to make sure I've code all the Variable and/or scripting code right like there is with the Basic Editor? I could publish the story-game, play through it and un-publish it if I need to correct anything but I don't want to publish something that might not work right. I'd be interesting to learn how to do it with Scripting, for my next story-game or two I just want to master variables but as I get the hang of the site's mechanics I might use items and scripting in my stories too :)

 

Can someone help me with the Variables?

10 years ago
Click on My Stuff, then click on your game. You should be able to play it through, that way.

Can someone help me with the Variables?

10 years ago

Thanks, that works great :D