Quote:
|
Originally Posted by _Z3phyr_
Thirdly, the actual checking of the tokens in the new GS2 is simple if you understand what I just said above. The function of this script is so that the player can change his or her clothing colors by saying /set PART COLOR. the first word this player should say is "/set" which should be equal to tokens[0] (or in GS1, "#t(0)" ).
NPC Code:
if (tokens[0] == "/set") {
...
}
The same applies to the other words, where tokens[1] (or, #t(1) in GS1) is the name of the part and tokens[2] (or, #t(2) in GS1) is the name of the color.
NPC Code:
if (tokens[1] in {"clothes","tunic"}) {
switch (tokens[2]) {
case "skin": setskincolor(tokens[3]); break;
case "coat": setcoatcolor(tokens[3]); break;
case "sleeve": setsleevecolor(tokens[3]); break;
case "shoe": setshoecolor(tokens[3]); break;
case "belt": setbeltcolor(tokens[3]); break;
default : message("**Error: Invalid part**"); break;
}
}
|
Correction, since I can't edit my post for some reason:
The function of the script is REALLY to say /set clothes_or_tunic PART COLOR.
I said this at the top of the post, but changed it there. My fault.
tokens[0] (#t(0)) is /set
tokens[1] (#t(1))is either clothes OR tunic
tokens[2] (etc) is PART
tokens[3] is COLOR
and btw the script the above poster made is good and all if you're fluent in GS2, but this tutorial is about teaching GS1 scripters how to do GS2, so yeah - teach it by relating one to the other.