PDA

View Full Version : I'm new to scripting...



TheBestGamer
12-06-2006, 12:01 AM
I want to learn the basics of Zscript, but I have NO experience whatsoever and I have NO IDEA how this works or where to start. Any help would be appreciated.

ShadowTiger
12-06-2006, 12:51 AM
I'm somewhat less new than you are, but I'm pretty much in the same boat. I've already been through the difficult part. This post (http://www.armageddongames.net/showpost.php?p=1102818&postcount=4) should give you a leg up on the game though. Read all four threads I link to in there. Good luck man. :) Check back here regularly for some n00b to n00b counseling. :blah:

TheBestGamer
12-06-2006, 01:34 AM
Sorry, but that doesn't help much. I have no experience in this at all, so what you and other people are saying in those threads is totally meaningless to me. I don't understand a word you're saying in there.

Petoe
12-06-2006, 07:52 AM
Yeah, not very helpful Josh. There should be a step by step guides, examples etc so that a monkey like me could understand something. But isn't there a script guide in the making? By koopa? That would probably help a lot because I have no experience and no idea of programming. And I am not the only one. It is really frustrating to know that there's this new revolutionary feature but you don't know how to use it. Oh well... maybe some time during this century a guide is released (sorry, I am so impatient! :p )

Imprisoned
12-06-2006, 09:22 AM
HOLY COW! I can't understand a word from the threads Read, All, These, or Threads.

I would like to know how to script too, but goddammit, those aren't working.

ShadowTiger
12-06-2006, 10:46 AM
lol yeah, yeah, I can understand how this might be confusing. It was just as confusing for me, believe me. It still is.

IMHO, the first step is to be able to -read- code though. Once you can read it successfully and know what's happening, you can pretty much leach off of any script that you see to get the necessary phrases for it and such.

Here's a piece of code that Saffith was kind enough to correct for me in one of those threads I linked to. I'll post the variables in red.


ffc script invulnerability_script_001
{
void run()
{
int storedHP = Link->HP;

while(true)
{
Link->HP = storedHP;
Waitframe();
}
}
}

Now, you all already know that anything after a // or between /* and */is a comment, right? Whatever content is within those /* and */ or after the // on the same line as the // will be completely ignored by the program. Hence, I'll exhibit this in the explanations of the code.

ffc script invulnerability_script_001 // This line defines this code as being an FF Script. (Hence the ffc script) part. You don't really need to know why you have to type ffc script, but only that you DO HAVE TO TYPE IT. The part in red, "invulne..." etc, is the part -I- defined as the name of the script.

void run() // Still not 100% clear on this line myself, but it's a line which makes the script run. Just like the above ffc script, put it in after a curly bracket anyway. Don't forget to put in a closing curly bracket (}) at the end of your code as soon as you create the opening brackey or you might forget to do it.

int storedHP = Link->HP; //First of all, remember to put a semicolon ( ; ) at the end of each line that doesn't open up into another series of content involving curly brackets. (I.e. an "if statement" or "While loop" probably won't need curly braces, (Brackets, whatever.) but a line like the above would, as it's solitary.) So this line is essentially setting the variable (We define its name and type.) "storedHP" to be an integer. (int, to its left. "int storedHP".) to be equal to Link's HP. Link-> is the reference to Link himself, or any attribute of his which will follow, and HP is the hit points for the particular NPC that comes before it. Thus, Link->HP is Link's HP. You can define a variable (Create it for use in the script.) this way, by defining it on the same line that it's being used to store something if you phrase it like it's been done here, by saying int yourvariable ... so now you've got a variable named yourvariable that's a type int. (An "integer" (int) is a data type that's basically whole numbers, negative or positive. 5, 2835, -523, 0, etc. A "float" is a decimal. -.0523, 2.593, 523.1, etc.

while(true) // This is a while loop. It checks for a certain condition, and if that condition is true, it executes everything within the curly braces that follow it. (See the line directly below this for the accompanying opening brace.)
{
Link->HP = storedHP; // This line is setting Link's HP to our variable, storedHP. Note the semicolon at the end of the line, and notice how there was no semicolon at the end of while(true). So this line is basically setting Link's HP to whatever the value of storedHP is over and over again, because the while loop is continually found to be true, as the thing it's checking for isn't really a variable; it's just an operation. It was conducted successfully, so it may as well go through with the while loop, as there was nothing to really check for. :shrug: It's like saying "If today is a day, do this." ... ... so it does. [/b][/font]
Waitframe(); // ... Yeah. This is a VERY Important command. :p It allows all of the other activities ZC's player does to cycle through while this code executes. If you didn't have it, ZC would probably freeze as it entered an infinite loop without giving ZC any chance to do anything else. Alright, it then ends with a closing curly brace, completing the while loop. Naturally, since it's a while loop, it'll keep executing the contents of the while loop while the condition is true. It's still true, so it'll keep executing.

Everything else is just a bunch of closing curly braces.

Saffith
12-06-2006, 01:02 PM
Now, you all already know that anything after a // or between /* and */is a comment, right? Whatever content is within those /* and */ or after the // on the same line as the // will be completely ignored by the program.Just //, actually. /* */ -style comments aren't implemented, currently.