Non-threaded

Forums » Newbie Central » Read Thread

Introduce yourself and get to know the community.

Scripting for Dummies (as in me)

14 years ago

All right guys, I am getting frustrated with myself here. I am trying to make a story about a basic fight scene in order to help myself learn about scripting because I learn better when I am working with what I am trying to learn, be it math or in this case scripting. I call this forum scripting for dummies because the question I am going to ask is very simple, I just can't wrap my head around it.

How do I make a Link Script?

I know, simple right? I keep re-reading alexp's article on scripting for how to make a link script (http://www.chooseyourstory.com/help/articles/article.aspx?ArticleId=45), but I can't wrap my head around it. I am trying to make one of the reader's options "slash", but I can't figure out how to do this. Do I need to make another variable? Do I need to do something with sourcing? If so, how?

I can't shake this nagging feeling that I am missing something quite obvious here...

Scripting for Dummies (as in me)

14 years ago

Do you want to make a link script, or do you want to make certain links appear and disappear depending on circumstances?

A link script is the script that is activated when you click on a link, and can be added to a link by clicking on the scripting symbol (:=) next to the link while in the storygame editor. If you want to make certain links appear and disappear, or change the text or text colour or whatever, you'll need to put that in the page script.

Which are you trying to do?

Scripting for Dummies (as in me)

14 years ago

Make a link script, thanks for helping me clarify. I'll try that now.

Scripting for Dummies (as in me)

14 years ago

Oh my God I am so stuck its not even funny. I don't even know enough to give a specific answer. I have the damage, life, and goblin (the goblin who you are fighting's life) variables, but I don't know how to make them work, even if I am reading this article. This is the most difficulty I have had in trying to learn something... I have a headache.

Scripting for Dummies (as in me)

14 years ago

This is how its not working.

http://www.myadventuregame.com/story/Bo's_Scripting_Test.aspx

As you can see, the damage variable doesn't work, so the goblin variable doesn't change.

Scripting for Dummies (as in me)

14 years ago

All right, more specific question, how do I make the variables affect one another, and if they are through scripting, how do I do so.

Example: I want life loss=Damage-accuracy, where Damage is 1-6 (six being the best) and any higher is a critical hit, and accuracy is 1-5 (one being the best) so that if something has the best accuracy (1) and damage (6), it will only be 6-1=5 life lost.

How would I put that into scripting language and how would I impliment it. I am still completely lost

 

Scripting for Dummies (as in me)

14 years ago

So to clarify you want damage to be a random number between 1 and 6 and accuracy a random number between 1 and 5, right? In that case, make the variables %LIFELOSS, %DAMAGE and %ACCURACY.

Link Script

%DAMAGE := 1D6
%ACCURACY := 1D5

%LIFELOSS := %DAMAGE - %ACCURACY
%GOBLIN := %GOBLIN - %LIFELOSS

The first line is saying set (:=) the variable damage (%DAMAGE) to 1D6 (which is basically as if you're rolling 1 dice with 6 sides, you can set this to 2D6 if you want and it'd be like you're rolling two 6-sided die).

The second line is saying set (:=) the variable accuracy (%ACCURACY) to 1D5 (random number between 1 and 5).

Third line is saying that the variable %LIFELOSS will be set to %DAMAGE minus %ACCURACY, which is what you wanted when you said "I want life loss=Damage-accuracy".

I'm assuming you want the goblin to lose this life, so in the fourth line it basically reads "set %GOBLIN to what it currently is, minus what %LIFELOSS is set to".

Of course, you could ignore making the three other variables and just have a way more simple script:

%GOBLIN := %GOBLIN - (1D6 - 1D5)

If you wanted to have text somewhere saying "the goblin lost X life" you'd have to have the %LIFELOSS variable there, and then put (without scripting, just on the page) "the goblin lost %%LIFELOSS%% life" which, if %LIFELOSS was set to 5, would read "the goblin lost 5 life".

Hope this helps, it's a bit confusing as to what you want but yeah. Also - I played your game, I'm not sure if it's intentional or not but when you attack the goblin, the health isn't subtracted from him until you click on the link "goblin". I'm not sure if this is intentional or not, so if it isn't intentional the mistake you've made is putting the life loss link script on the "goblin" link, not on the "slash/stab/chop" link.

Scripting for Dummies (as in me)

14 years ago

All right, that helps, thanks

Scripting for Dummies (as in me)

14 years ago

Bo could you make me a co-author to your varible test, maybe i can figure it out.

Scripting for Dummies (as in me)

14 years ago

lol i did not see the last two comments on this thread, somehow they literly just evaded me. i need to get my eyes checked.

Scripting for Dummies (as in me)

14 years ago

Yeah, I will. I need to unpublish it anyway to vix some of the variables and scripting. The main problem was I didn't get how to subtract or even make random variables So I just used the same variables and looped the pages.

Scripting for Dummies (as in me)

14 years ago

Used the same "solid" variables*

I mean solid as in %GOBLIN  := %GOBLIN - 3 rather than something random.

Scripting for Dummies (as in me)

14 years ago

Newest Question, I've noticed that  the goblin can actually gain life. I'm assuming that this means somewhere in the equation there is a -1, so he is actually gaining life during the attack. I recall reading something about this in alexp's article, but I can't find it.

Scripting for Dummies (as in me)

14 years ago

I'm confused by what you're saying in the other post about "solid" variables but yeah, I'm thinking that %ACCURACY was higher than %DAMAGE, meaning that %LIFELOSS ended up being a negative number, resulting in the goblin gaining life.

 

Scripting for Dummies (as in me)

14 years ago

i allready fixed this for him and explained it, can you tell me how to put in a global script please?

Scripting for Dummies (as in me)

14 years ago

You know how at the top of the storygame editor there's the menu bar with Storygame Properties / Items / Variables etc.? Click on "Scripts", then on that page click on the icon next to either Global Page or Global Link (depending on which you want to change) and then insert your script. Done!

Scripting for Dummies (as in me)

14 years ago

does this require me to have advanced scripting enabled?

Scripting for Dummies (as in me)

14 years ago

never mind, it does. ive figured it out. thanks october.

Scripting for Dummies (as in me)

14 years ago

No problems!

Scripting for Dummies (as in me)

14 years ago

I feel that even after that one day of scripting, my knowledge on the matter has grown by a lot. even though I don't know much compared to others I'm starting to find better, more efficient ways to do things that I already started, how to fix a few problems, and even a rough draft of how to make traits with attribute points affect the game. This might not be a huge collection of scripting know-how, but I think it is a good start.

Scripting for Dummies (as in me)

14 years ago
Learning scripting is a very satisfying feeling.

Scripting for Dummies (as in me)

14 years ago

Its almost like learning another language, lol.

Scripting for Dummies (as in me)

14 years ago

Definitely dude, it literally only takes a few days to understand scripting if you put your mind to it. It looks daunting at first but it's really easy to get the hang of. And the finer points of scripting you can just ask about on the forums - everyone still posts scripting help on the forums or asks others for help (myself included).

Scripting for Dummies (as in me)

14 years ago
Except me, I never need help because I'm the best. Hahhahaha just kidding.

But yeah, it's actually not challenging to learn the basics (like learning your ABC's and basic grammar), what's challenging is figuring out the best way to use it to solve your problem. Almost anything can be done with scripting to the mind with enough creativity, whereas the tools are nearly useless to he who learns only the rules.

Scripting for Dummies (as in me)

14 years ago
Very well said, JJJ.

But yea, now that you know what everything does, and what the functions of it are, its just like a bunch of small little puzzles to get it to do precisely what you want it to do.

Scripting for Dummies (as in me)

14 years ago

Like using a counter. I thought that was work of pure genius.

Scripting for Dummies (as in me)

14 years ago

Ive missed your meaning SindriV. could you explain?

Scripting for Dummies (as in me)

14 years ago

%COUNTER := 1

%HEALTH := %HEALTH - %COUNTER

%CHARGE := %CHARGE + %COUNTER

As far as I can see, a counter is a variable you can have to simply alter something over time. The two examples I listed shows that COUNTER could be used to make both poison and how much charge something electric has. Although I am sure there are many, many other uses.

Scripting for Dummies (as in me)

14 years ago

Actually it's more like

(In the global links):

%COUNTER := %COUNTER - 1

IF %COUNTER := 0
THEN BEGIN
%COUNTER := 5
BATTERY := BATTERY + 1
END

Basically, this means that the counter goes in an endless circle, reaching 0 once in every circle, and everytime the counter gets down to 0, the battery gains 1. Which means that the battery increases every fifth link you click. Get it?

Scripting for Dummies (as in me)

14 years ago

Yeah, I see how that would work.

Scripting for Dummies (as in me)

14 years ago

Coding (thats like scripting right?) song. http://www.youtube.com/watch?v=v4Wy7gRGgeA

I wouldn't be surprised if you guys have heard this before, this guy is a super famous video game song writer.