Example:
01 | Array = { "Hi" , "Bye" , "Hello" , "Thankyou" } |
02 | Array 2 = { "Super" , "Fast" , "Slow" , "Thinker" } |
03 | StringValue = "One of the Array Values" |
04 |
05 | for s = 1 , 4 do |
06 | wait( 1 ) |
07 | RandomArray = math.random( 1 , 2 ) |
08 | if RandomArray = = 2 then RandomArray = Array 2 |
09 | else if RandomArray = = 1 then RandomArray = Array |
10 | StringValue = tostring (RandomArray [ s ] ..s, ' ' ) |
11 | s = s+ 1 |
12 | print (StringValue) |
13 | end end end |
So basically what this psuedo (it doesn't work) script is suppose to do is randomly choose an array and chronologically print the values of the array values so if RandomArray=1 RandomArray=Array and if [s] = 4 then It should print the value Thankyou. The StringValue would look like this v StringValue=tostring(Array[4]..s' ') print(Array[4]..s)==print(StringValue)
Thankyou4
Novice Scripter "SamDomino"
You only need two end
s and s increases by 1 by default. Also the values in the tables are already strings so there is no need for tostring()
I took out the ..s,' '
because if s was 1 it would have printed "HiHi "
. Finally I am pretty sure you can't put commas in the variable to concatenate that. So it would be:
01 | Array = { "Hi" , "Bye" , "Hello" , "Thankyou" } |
02 | Array 2 = { "Super" , "Fast" , "Slow" , "Thinker" } |
03 | StringValue = "One of the Array Values" |
04 |
05 | for s = 1 , 4 do |
06 | wait( 1 ) |
07 | RandomArray = math.random( 1 , 2 ) |
08 | if RandomArray = = 2 then |
09 | RandomArray = Array 2 |
10 | else if RandomArray = = 1 then |
11 | RandomArray = Array |
12 | StringValue = RandomArray [ s ] --If s was 1 then this would print: "Hi" |
13 | print (StringValue) |
14 | end |
15 | end |