using the computer's command line~prompt (start -> run -> cmd), as this is similiar to one of the simpliest~first languages: MS-DOS
quest's Scriptings (Commands, Functions, Turnscripts, Timers, Verbs ~ 'Script' Type Attributes, and etc) act in this same way: as the looping blocks
-------
we want code that will count up by 1, starting with 0, thus like this:
0 -> 1 -> 2 -> 3 -> 4 -> 5 -> etc etc etc
--------
Wrong structure:
:start
x = 0
x = x + 1
goto start // this loops back to the ':start'
output:
x = 0
x = 0 + 1 = 1
x = 0
x = 0 + 1 = 1
x = 0
x = 0 + 1 = 1
etc etc etc
the initial setting of 'x = 0' is inside of the looping block
-------------------------
Correct structure:
x = 0
:start
x = x + 1
goto start
output:
x = 0
x = 0 + 1 = 1
x = 1 + 1 = 2
x = 2 + 1 = 3
x = 3 + 1 = 4
etc etc etc
the initial setting of 'x = 0' is outside of the looping block
-----------
example in quest:
the 'foreach' is a built-in automatic looping function, as it is applying the scripts for each~all~every thing in the list
---------
let's say I want to create my own list displayment:
1. blah1
2. blah2
3. blah3
4. blah4
etc etc etc
--- this was before I knew about:
DisplayList (
http://docs.textadventures.co.uk/quest/ ... ylist.html )
DisplayList (Object_name.ListAttribute_name, true:ordered_or_false:disordered)
DisplayList (Object_name.ListAttribute_name, true)
~OR~
DisplayList (Object_name.ListAttribute_name, false)
lololol ... I wonder if the 'DisplayList:ordered' is achieved as I did did it, hmm... hehe
-----------
Wrong structure:
foreach (color_variable, split ("red;blue;yellow", ";")) {
x = 0
x = x + 1
msg (x + ". " + color_variable)
}
output:
1. red
1. blue
1. yellow
------------------------------
Correct structure:
x = 0
foreach (color_variable, split ("red;blue;yellow", ";")) {
x = x + 1
msg (x + ". " + color_variable)
}
output:
1. red
2. blue
3. yellow