Difference between revisions of "User:Toady Nakamura/Touch Counting"
Jump to navigation
Jump to search
m (start page) |
m (always one typo on new page) |
||
Line 40: | Line 40: | ||
</lsl> | </lsl> | ||
Visit my LSL wiki page for my library of simple scripts ! [[User:Toady Nakamura|Toady Nakamura]] | |||
[[User:Toady Nakamura|Toady Nakamura]] |
Revision as of 13:39, 19 July 2012
Counting - also called incrementing - can be confusing.
Here are two sample scripts to show you how to count up and down !!
Count Up
<lsl> integer num = 0; // sets initial value at zero, so first one will be one
default {
touch_start(integer total_number) { num++; // increment the value of *num* upwards llSetText("The value of num is now " + (string)num + " \n Touch me to increment upwards", <1,1,1>,1); }
}
</lsl>
Count Down
<lsl> integer num = 100; // sets initial value to count down from
default {
touch_start(integer total_number) { num--; // increment the value of *num* downwards
llSetText((string)num + " bottles of prims on the wall \n" + (string)num + " bottles of prims... \n Touch me to increment down", <1,1,1>,1); }
}
</lsl>
Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura