Arrow Keys trigger

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Ozzapoo
The Flying Cow!
Posts: 2196
Joined: November 2nd, 2007, 10:34 pm
Location: Melbourne

Arrow Keys trigger

Post by Ozzapoo »

I was having a bit of trouble making an IF statement...

I am trying to make something like this: (Please note that this isn't real JASS, but it's just to get the point to you)

if bj_LeftKeyIsDown then
elseif bj_RightKeyIsDown then
elseif bj_UpKeyIsDown then
elseif bj_DownKeyIsDown then
endif

So.. How would I do that? I couldn't find anything ><
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Arrow Keys trigger

Post by weirdone2 »

You'll have to register the keystrokes, seach left in jasscraft and you should come across the rite keystrokes, and look in a cheatpack that has bindkeys for example. >.>
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Arrow Keys trigger

Post by Aero »

Ozzapoo wrote:I was having a bit of trouble making an IF statement...

I am trying to make something like this: (Please note that this isn't real JASS, but it's just to get the point to you)

if bj_LeftKeyIsDown then
elseif bj_RightKeyIsDown then
elseif bj_UpKeyIsDown then
elseif bj_DownKeyIsDown then
endif

So.. How would I do that? I couldn't find anything ><
Doesn't exist. You'll have to backdoor it.
Make 4 boolean array with false as default.

isLeftDown[]
isRightDown[]
isUpDown[]
isDownDown[]

Make 2 triggers.

Trigger 1:
Player presses up arrow key
Player presses down arrow key
Player presses left arrow key
Player presses right arrow key

Event:
(Let's say the left arrow key was pressed)
set isLeftDown[Player number of triggering player]=true

Trigger 2:
Same as Trigger 1 but the event is a player RELEASES the key and you would set the boolean array value to false instead.

Between these 2 triggers you can figure out if a player is holding down an arrow key because the boolean array gets set to false if a player releases the key.
User avatar
Ozzapoo
The Flying Cow!
Posts: 2196
Joined: November 2nd, 2007, 10:34 pm
Location: Melbourne

Re: Arrow Keys trigger

Post by Ozzapoo »

I figured that out ages ago... >.>
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Arrow Keys trigger

Post by Aero »

That's fine. I've just been away from site for like 2 weeks and am getting caught up on all the threads I havn't answered.
Besides, someone else might have had the same question and if they were to look here, the answer is now there.