Varubles in an array???
krazyideas
Posts: 119
So I finaly understand makeing varubles work, but I want to know how to use an array of varubles.
How do you access each varuble in an array so you can enter the disired information into them or alter then info already in them??
I understand that they are automaticaly numbered, but what would the code look like to work with them with the keyboard??
this is what I am thinking but I'm really not sure· if I'm on the right track.
I would love some pointers
Thanks
Var long walk[noparse][[/noparse]7], step[noparse][[/noparse]0], step[noparse][[/noparse]1], step[noparse][[/noparse]2], step[noparse][[/noparse]3], step[noparse][[/noparse]4], step[noparse][[/noparse]5], step[noparse][[/noparse]6]
· long up
·· up······· := 3
·· step[noparse][[/noparse]0] := 6
·· step[noparse][[/noparse]1] := 8
·· step[noparse][[/noparse]2] := 3
·· step[noparse][[/noparse]3] := 22
·· step[noparse][[/noparse]4] := 10
·· ect...
repeat
·if newkey == "a"
····· walk·:= step[noparse][[/noparse]0]
·· elseif newkey := "+"
···· step[noparse][[/noparse]0] := step[noparse][[/noparse]0] + up
·· elseif newkey := "-"
·····step[noparse][[/noparse]0] := step[noparse][[/noparse]0] - up
·if newkey == "s"
····· walk := step[noparse][[/noparse]1]
·· elseif newkey := "+"
···· ·step[noparse][[/noparse]1] := step[noparse][[/noparse]1] + up
·· elseif newkey := "-"
···· ·step[noparse][[/noparse]1] := step[noparse][[/noparse]1] - up
·ect.. till step[noparse][[/noparse]6]
·
How do you access each varuble in an array so you can enter the disired information into them or alter then info already in them??
I understand that they are automaticaly numbered, but what would the code look like to work with them with the keyboard??
this is what I am thinking but I'm really not sure· if I'm on the right track.
I would love some pointers
Thanks
Var long walk[noparse][[/noparse]7], step[noparse][[/noparse]0], step[noparse][[/noparse]1], step[noparse][[/noparse]2], step[noparse][[/noparse]3], step[noparse][[/noparse]4], step[noparse][[/noparse]5], step[noparse][[/noparse]6]
· long up
·· up······· := 3
·· step[noparse][[/noparse]0] := 6
·· step[noparse][[/noparse]1] := 8
·· step[noparse][[/noparse]2] := 3
·· step[noparse][[/noparse]3] := 22
·· step[noparse][[/noparse]4] := 10
·· ect...
repeat
·if newkey == "a"
····· walk·:= step[noparse][[/noparse]0]
·· elseif newkey := "+"
···· step[noparse][[/noparse]0] := step[noparse][[/noparse]0] + up
·· elseif newkey := "-"
·····step[noparse][[/noparse]0] := step[noparse][[/noparse]0] - up
·if newkey == "s"
····· walk := step[noparse][[/noparse]1]
·· elseif newkey := "+"
···· ·step[noparse][[/noparse]1] := step[noparse][[/noparse]1] + up
·· elseif newkey := "-"
···· ·step[noparse][[/noparse]1] := step[noparse][[/noparse]1] - up
·ect.. till step[noparse][[/noparse]6]
·
Comments
Chang this to
See if that helps