by rknigh21
on 12/13/2008 01:56, 2 messages, last message: 12/27/2008 09:27, 1340 views, last view: 05/05/2024 09:26 |
quite an extensive tutorial, I'm busy gonig through it, but it's hard not to say anything about some stuff
loop i 10 [ echo "i holds " $i ]
that is wrong in my books, there's three ways at least in which it can be acceptable, they're as follows
loop i 10 [ echo [i holds $i] ]
loop i 10 [ echo (concatword "i holds " $i) ]
loop i 10 [ echo (format "i holds %1" $i) ]
while [(< $i 10 )] [ echo $i ; i = (+ $i 1)]
the reason the first needs to be in []'s is because it'd only get evaluated once otherwise, observer
while (< $i 10 ) [ echo $i ; i = (+ $i 1)]
while true [ echo 0 ; i = 1]
while true [ echo 1 ; i = 2]
...
while true [ echo 9 ; i = 10]
while true [ echo 10 ; i = 11]
the true is never re evaluated again, unlike like when you gave it
while [(< $i 10 )] [ echo $i ; i = (+ $i 1)]
(< $1 10) is evaluated on each execution, so, it'd end as follows when compared to the above, assuming i == 0
while true [ echo 9 ; i = 10]
while false [ echo 10 ; i = 11]
next problem :P
checkkey = [ If ( = $greenkey 1 ) [ echo "You have the key"] ["Try to find the key"]]
you're missing an echo in the second pair of []'s :P
note that checkey = [ echo (if (= $greenkey 1) "You have the key" "Try to find the key")] should be equivalent :)
same can be said for the second instance that uses $arg1 for it's validation
level_trigger_22 = [ Echo "You fired the trigger "]
sauer is case sensitive, Echo is an invalid command
I skimmed the rest, couldn't find any faults in the brief skimming :)
though you may wait to mention there are floating point variations of the commands if you add an 'f' suffix, ie (+f 1.1 2.4123)
the full list of functions are as follows
+ - add
- - subtract
* - multiply
div - division
mod - modulous
= - equality test
!= - inequality test
< - less than
> - greater than
<= - less than or equal
>= - greater than of equal
^ - either, but it can't be both or neither
! - swaps true and false
min - returns the variable with the lowest value
max returns varaible with highest value
&& - checks if both are true
|| - checks if either ot both are true
there's string commands too like strstr (sees if given text is in a string, -1 if false), strcmp, strreplace, and obviously concat, concatword, format, at, push, pop, substr, listlen, getalias, result
lastly, I'm surprised you didn't do anything on the @ stuff
an example
mainmenu = [
guitext "This is a menu w00t!"
guibar
guibutton "I am button! click me!" "cleargui"
]
newgui main [@mainmenu]
hope this all helps you improve your tutorial :)
reply to this message
|