<<Prev 1 2 3 4 Next>>
VBScript Program
The VBScript module is used to run a small conversion program that creates a single variable from
the values received from the PC Joystick. The following is the top part of the VBScript module
interface showing part of the code within a text box (you can alternatively use the filename to specify
a file on your filesystem).
The VBScript program is as follows
' set the initial move to nothing
move=0
' if the joystick is to the right assign bit 2
if GetVariable("joy_x") < -200 then
move = 4
' otherwise if it is to the left assign bit 3
elseif GetVariable("joy_x") > 200 then
move = 8
end if
' now add in the y coordinate by ORing the
' value with the appropriate bits
if GetVariable("joy_y") > 200 then
move = move OR 1
elseif GetVariable("joy_y") < -200 then
move = move OR 2
end if
' and finally add in the fire button
' if it is pressed
if GetVariable("fire") then
move = move OR 16
end if
' the results are in the single
' variable move. Assign that
' back into RoboRealm so we
' can use it in other modules
SetVariable "move", move
We finally go back to our DC_Missile module and assign the variable to "move" since that is the variable we
created in the VBScript program that contains the correct bits that the Launcher understands.
The RoboRealm program pipeline finally looks like
Given all these parts lets see what it looks like in action ...
<<Prev 1 2 3 4 Next>>
|