PDA

View Full Version : tricky scripting problem


MFreywald
13-06-2005, 08:47 AM
Ok, lets try to explain this correctly..

I want to set a toggle device (D1) to toggle only if a button is pressed and another is not pressed. For instance...this is a clear script for what I want, but unfortunatly it doesn't like it..

IF (NOT JS2.B4) THEN
ÂÂ* TOGGLE (D1) = JS2.B3;
ENDIF

Any ideas on how to set the toggle using that logic?

Bob, would be nice to be able to stick defines like that in IF and SEQUENCE blocks.


MFreywald

abe_beson
13-06-2005, 09:45 AM
Hi MFreywald!

Is this what you want to do?

toggle(D1)=js2.b3 and not js2.b4;

/Abe

Bob Church
14-06-2005, 03:14 AM
Hi MFreywald,

>> Ok, lets try to explain this correctly..

I want to set a toggle device (D1) to toggle only if a button is pressed and another is not pressed. For instance...this is a clear script for what I want, but unfortunatly it doesn't like it..

IF (NOT JS2.B4) THEN
TOGGLE (D1) = JS2.B3;
ENDIF

Any ideas on how to set the toggle using that logic? <<

Well, you can't really put the devcie (TOGGLE) in the IF/THEN block. It creates problems since the code in the block isn't executed. Offhand, I'd think maybe a TOGGLE could be done, but in general the device declarations (timers and such) would have trouble.

Abes idea:

>> toggle(D1)=js2.b3 and not js2.b4; <<

would compile okay and it might do what you want, but I think it has troubles, too. While js2.b3 would toggle it when js2.b4 was released (which I think is what you want), js2.b4 would toggle while js2.b3 was pressed, and I think that's not what you want.

I think what I'd try is more a combination of the two:

if( not js1.b4 ) then
b1 = js2.b3;;
endIf
toggle( d1 ) = b1;

That lets the "not js1.b4" gate b1, which gets around the side-effect in Abes version about as well as you can. Having js1.b4 pressed just locks the toggle out that way. Would that work for you?

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

abe_beson
14-06-2005, 10:40 AM
Good point Bob! :)

/Abe

MFreywald
14-06-2005, 08:58 PM
Yeah, I think that'll do the trick actually. This is for my GTA SA profile. I have my throttle pinky button set to be the shift but also have it set to press the sprint key. Then I have the middle button (next to pinky) set to be the crouch and shifted be the walk. Then I have the index finger button set to jump and shifted set to aim weapon. My problem was that when I was crouching and then held down the shift button and the aim it would stand up cause of the sprint key. But I can get around that using CMS buttons and the KEYS command. I just needed a way to keep the crouch held down without triggering the walk also. Yes, I know...very very confusing. But it's the only way I could get the main 'hold' keys groupped comfortably. Anyway, I'll give this a try... thanks Bob.

MFreywald

PS..not that this makes a difference..but it should of read..JS2.B4 and not JS1.B4. :)