Sillyman
Level: Smiter
Rank Points: 339
Registered: 09-08-2006
IP: Logged
|
Re: Can anyone make a really GOOD scripting tutorial? (0)
Alrighty...:
If, Else, End If: Uses the next statement as a condition, if possible. Most "Wait" statements can be used as conditions, with ignoring the statement=TRUE and waiting for one or more turns=FALSE. So can Question if there are no Answer Options, with Yes=TRUE and No=FALSE. Wait Until Var is highly useful, for what I should hope are obvious reasons. Then is implied, else is not. To close an If block, use End if. There is no command to break out of an if block, aside from GOTO.
Example (Note that this is hand-typed and cannot be pasted easily into DROD):
Wait 5
If..
Wait for player at 4,4
Speech "Muehehe"
Else
Speech "Onos!"
End if
This will wait five turns, then make a comment based on whether the player is at 4,4 or elsewhere.
Label, Goto: Sadly, GOTO is highly necessary in DROD script because there is no concept of a function. Also, all jump targets are hardcoded. You must make the target label first, then it will appear in Goto's list and can be selected. Then, when the script encounters the Goto, it jumps to the specified label.
Question, Answer Option: Question can do two different things: Either it can present a menu of options associated with labels, and selecting one jumps to that point, or it can ask a yes or no question. The second form can be used as a conditional in if statements, or as a no-op that displays a dialog box outside of them. (That is, neither answer does anything if there are no answer options and it is not being used as a condition to an If statement.) To use the first form, you must first specify a list of Answer Options, one at a time. Each answer option consists of a bit of text and a label. If answer options have been set, Question will display them as a menu, and then go to the label of the one the player selects. Afterwards it will clear the set answer options and any further question will be a Yes/No question unless they are set again.
Wait 0: Wait 0 is mostly used in keeping a script running despite infinite loops. If a script runs for too long, it is presumed to be an infinite loop and ended. If you want to check for several conditions each turn, (or probably other uses, though this is the main one), then you need a loop over If statements, with a wait 0 at the end or beginning to make it wait a turn instead of being ended. There is a difference between wait 0 and wait 1, though I can't remember it at the moment.
Everything else should do exactly what it says on the tin, IIRC... although the built-in variables in DROD RPG are tricksy...
That clear enough?
____________________________
Who, me?
FNORD
[Last edited by Sillyman at 11-01-2008 06:12 PM]
|