worsel
14th March 2010, 06:12 AM
Hi Bob,
Many years ago (April 2003), you helped me write a script to use my Fighterstick in a video game called Splinter Cell.
Splinter Cell was unique because it used the mousewheel to scroll through 4 different run speeds. I have attached the map and script files... I hope you remember them.
I now have a different problem, but I believe the code you wrote for Splinter Cell holds the key.
First a quick re-cap on how I use my Fighterstick USB for Shooter Games:
Forward on the Joystick moves my character Forward... normally done with 'w' on the keyboard.
Backwards on the Joystick moves my character Backwards... 's' on the keyboard.
Pushing the Joystick to the Right makes my character Strafe to the Right... 'd' on keyboard.
Pushing the Joystick to the Left makes my character Strafe to the Left... 'a' on keyboard.
These games normally have 2 speeds; walk and run... run being "ON" by default. Usually holding down the 'Shift' button makes you walk. Releasing the 'Shift' button makes you resume running.
I have made numerous scripts to accomplish this... very simple because the "WALK" modifier is accomplished by holding down the "WALK" button. It is NOT a toggled event.
Now comes the problem.
I am trying to write a script for 2-speed movement in a game called "Lord of the Rings Online". The difference is that the "Walk-Run" command is a toggled one. So as the Joystick moves from centre and through a deadzone, the movement command will be given (in this case w, s, e, or q)... When it then reaches a 3rd zone, the "walk-run" button must be pressed and released. But when the joystick is moved back into zone 2 from zone 3, the walk-run button must be pressed and released again. This must be kept track of so you are walking when the joystick is in zone 2, and running when in zone 3. Zone 1 is the deadzone.
In my normal walk-run scripts, where the walk-run button must be held, it is a simple case of checking to see where the joystick is positioned, and then turning the walk-run button on or off.
This is how I do it normally:
cms.b1 = w (forward)
cms.b2 = d (strafe right)
cms.b3 = s (backward)
cms.b4 = a (strafe left)
cms.b5 = LSHF (walk when pressed, run when released)
First I check to see how far away the joystick is from centre. Since I do not care what direction it is in, just how far from centre, I use pythagorus' theorem a^2=b^2 + c^2. Since there is no function for taking the square root of a number, I just work with a^2, or the square of the distance from centre, as so:
a1 = ((js1.a1 - 128) * (js1.a1 - 128)) + ((js1.a2 - 128) * (js1.a2 - 128));
where a1 = the square of the distance that the joystick is from centre... the joystick's position from centre.
Then I check to see if a1 is in the walk zone or the run zone... 70 units, or a value of 4900, from centre:
IF ( [ A1 < 4900 ] ) THEN
CMS.B5 = TRUE;
ELSE
CMS.B5 = FALSE;
ENDIF
Then I decide which 'direction buttons' (w, s, a, or d) should be pressed at any given time, as long as the joystick is out of the deadzone. In the following example, the deadzone is from 0 to 196, where 196 is the square of the distance the joystick is from centre:
IF ( [ A1 > 196 ] ) THEN
// Forward
IF ( [JS1.A2 < 122] ) THEN
CMS.B1 = TRUE;
ELSE
CMS.B1 = FALSE;
ENDIF
// Right
IF ( [JS1.A1 > 134] ) THEN
CMS.B2 = TRUE;
ELSE
CMS.B2 = FALSE;
ENDIF
// Backwards
IF ( [JS1.A2 > 134] ) THEN
CMS.B3 = TRUE;
ELSE
CMS.B3 = FALSE;
ENDIF
// Left
IF ( [JS1.A1 < 122] ) THEN
CMS.B4 = TRUE;
ELSE
CMS.B4 = FALSE;
ENDIF
ELSE
CMS.B1=FALSE;
CMS.B2=FALSE;
CMS.B3=FALSE;
CMS.B4=FALSE;
ENDIF
And that's it... But, when the walk-run event is toggled, the task is MUCH more difficult because you have to press and release the walk-run button every time the joystick passes over the walk-run threshold. That's why I figured the script you wrote for Splinter Cell was the key to the answer. I have monkeyed around with it, and cannot get it to work.
I have also sent my non-working script (called "LOTRO Map.zip").
Your original solution for Splinter Cell is also attached (called "Splinter Cell Map.zip").
In the Lord of the Rings Online (LOTRO) game, the commands are as follows:
Move Forward = w
Move Backward = s
Strafe Right = e
Strafe Left = q
Walk-Run Toggle = KBINS (INSERT key)
So the way the walking and running works is as follows:
If you move any of the movement keys (w, s. e, or q), and you are running, if you press and release the INSERT key, you will start walking. And conversely, at any given time, if you are walking, pressing and releasing the INSERT key will make you start running.
Thanks, any help would be HUGELY appreciated.
Regards,
Rob Manning
email: worsel@mail.com
Many years ago (April 2003), you helped me write a script to use my Fighterstick in a video game called Splinter Cell.
Splinter Cell was unique because it used the mousewheel to scroll through 4 different run speeds. I have attached the map and script files... I hope you remember them.
I now have a different problem, but I believe the code you wrote for Splinter Cell holds the key.
First a quick re-cap on how I use my Fighterstick USB for Shooter Games:
Forward on the Joystick moves my character Forward... normally done with 'w' on the keyboard.
Backwards on the Joystick moves my character Backwards... 's' on the keyboard.
Pushing the Joystick to the Right makes my character Strafe to the Right... 'd' on keyboard.
Pushing the Joystick to the Left makes my character Strafe to the Left... 'a' on keyboard.
These games normally have 2 speeds; walk and run... run being "ON" by default. Usually holding down the 'Shift' button makes you walk. Releasing the 'Shift' button makes you resume running.
I have made numerous scripts to accomplish this... very simple because the "WALK" modifier is accomplished by holding down the "WALK" button. It is NOT a toggled event.
Now comes the problem.
I am trying to write a script for 2-speed movement in a game called "Lord of the Rings Online". The difference is that the "Walk-Run" command is a toggled one. So as the Joystick moves from centre and through a deadzone, the movement command will be given (in this case w, s, e, or q)... When it then reaches a 3rd zone, the "walk-run" button must be pressed and released. But when the joystick is moved back into zone 2 from zone 3, the walk-run button must be pressed and released again. This must be kept track of so you are walking when the joystick is in zone 2, and running when in zone 3. Zone 1 is the deadzone.
In my normal walk-run scripts, where the walk-run button must be held, it is a simple case of checking to see where the joystick is positioned, and then turning the walk-run button on or off.
This is how I do it normally:
cms.b1 = w (forward)
cms.b2 = d (strafe right)
cms.b3 = s (backward)
cms.b4 = a (strafe left)
cms.b5 = LSHF (walk when pressed, run when released)
First I check to see how far away the joystick is from centre. Since I do not care what direction it is in, just how far from centre, I use pythagorus' theorem a^2=b^2 + c^2. Since there is no function for taking the square root of a number, I just work with a^2, or the square of the distance from centre, as so:
a1 = ((js1.a1 - 128) * (js1.a1 - 128)) + ((js1.a2 - 128) * (js1.a2 - 128));
where a1 = the square of the distance that the joystick is from centre... the joystick's position from centre.
Then I check to see if a1 is in the walk zone or the run zone... 70 units, or a value of 4900, from centre:
IF ( [ A1 < 4900 ] ) THEN
CMS.B5 = TRUE;
ELSE
CMS.B5 = FALSE;
ENDIF
Then I decide which 'direction buttons' (w, s, a, or d) should be pressed at any given time, as long as the joystick is out of the deadzone. In the following example, the deadzone is from 0 to 196, where 196 is the square of the distance the joystick is from centre:
IF ( [ A1 > 196 ] ) THEN
// Forward
IF ( [JS1.A2 < 122] ) THEN
CMS.B1 = TRUE;
ELSE
CMS.B1 = FALSE;
ENDIF
// Right
IF ( [JS1.A1 > 134] ) THEN
CMS.B2 = TRUE;
ELSE
CMS.B2 = FALSE;
ENDIF
// Backwards
IF ( [JS1.A2 > 134] ) THEN
CMS.B3 = TRUE;
ELSE
CMS.B3 = FALSE;
ENDIF
// Left
IF ( [JS1.A1 < 122] ) THEN
CMS.B4 = TRUE;
ELSE
CMS.B4 = FALSE;
ENDIF
ELSE
CMS.B1=FALSE;
CMS.B2=FALSE;
CMS.B3=FALSE;
CMS.B4=FALSE;
ENDIF
And that's it... But, when the walk-run event is toggled, the task is MUCH more difficult because you have to press and release the walk-run button every time the joystick passes over the walk-run threshold. That's why I figured the script you wrote for Splinter Cell was the key to the answer. I have monkeyed around with it, and cannot get it to work.
I have also sent my non-working script (called "LOTRO Map.zip").
Your original solution for Splinter Cell is also attached (called "Splinter Cell Map.zip").
In the Lord of the Rings Online (LOTRO) game, the commands are as follows:
Move Forward = w
Move Backward = s
Strafe Right = e
Strafe Left = q
Walk-Run Toggle = KBINS (INSERT key)
So the way the walking and running works is as follows:
If you move any of the movement keys (w, s. e, or q), and you are running, if you press and release the INSERT key, you will start walking. And conversely, at any given time, if you are walking, pressing and releasing the INSERT key will make you start running.
Thanks, any help would be HUGELY appreciated.
Regards,
Rob Manning
email: worsel@mail.com