Another Keyguard Issue

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Another Keyguard Issue

Postby John4 » Wed Dec 03, 2008 12:09 am

I put in this code,

Code: Select all
Sub ProcessKeyStrokes(CurrentFrame, KeyID)
'All keystroke actions you'd like to perform come here
'----------------------------------------------------- 
'1 = Arrow Left
'2 = Arrow Right
'3 = Arrow Up
'4 = Arrow Down
'10 = Space Bar
'13 = X Key
'12 = C Key

End Sub

Sub KeyGuard_KeyPressed(KeyID)
ProcessKeyStrokes GetCurrentFrameName, KeyID(0)
End Sub

Sub ProcessKeyStrokes(CurrentFrame, KeyID)
If CurrentFrame="csBLACK" Then
If KeyID = 3 Then
Action.GoToFrame "csPINK"
End If
End If

If CurrentFrame="csPINK" Then
If KeyID = 1 Then
Action.GoToFrame "csYELLOW"
Else If KeyID = 2 Then
Action.GoToFrame "csGREY"
Else If KeyID= 3 Then
Action.GoToFrame "csPURPLE"
Else If KEY ID= 4 Then
Action.GoToFrame "csBLACK"
End If
End If
End If
End If
End If
End Sub

and when I try it, it says, Expected 'Then'. Help, please?
What does it mean by this, and how I can I fix it?

Thanks!

~John
John4
Member
 
Posts: 23
Joined: Sun Apr 06, 2008 7:06 pm

Postby mercedes » Wed Dec 03, 2008 7:25 am

Hi there....:)

I'ts your statements...You have way to many "If's" and "Thens" with no expectations of what u want to happen...

Please explain what u want the user to do...

Do u want the user to go to Another frame if KeyID = 3 Or If CurrentFrame = csblack..Or both..

I think this is what u want..If not..u will have to explain a bit better...:)


Code: Select all
If
CurrentFrame="csBLACK" Then
KeyID = 3
Action.GoToFrame "csPINK"
End If


If CurrentFrame="csPINK" Then
KeyID = 1
Action.GoToFrame "csYELLOW"
Else
If KeyID = 2
Action.GoToFrame "csGREY"

End if
End if

Last edited by mercedes on Wed Dec 03, 2008 8:15 am, edited 2 times in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby ShadowHunter » Wed Dec 03, 2008 7:59 am

Hi,

As far as I can see you have correctly closed all your statements. However I would try the following instead:

There is something called ElseIf (not else if, note the space between)

Which works like this

Code: Select all
If....

ElseIf...

ElseIf...

ElseIf...

End If...

You should nest your statements so deep.

You could consider Select Case instead of If statementens

Code: Select all
Select Case VAR1

Case Is = 1

Do stuff

Case Is = 2

Do other stuff

Case Is = 3

Do another other stuff

End Select

Good luck

ShAdOwHuNtEr
Last edited by ShadowHunter on Wed Dec 03, 2008 8:08 am, edited 3 times in total.
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby mercedes » Wed Dec 03, 2008 8:06 am

Oh ya....thats right..never looked at all of the Else's..I think i amended my post now..to view it correctly..

Although the Else If...I don't think we can use that with VBS right..Shadow..? together in one statement..Thats where i get messed up..I have used ElseIf...but not in AM..With AM u have to separate them..on different lines..as far as i've seen..:?..probably wrong there..but I know i've tried it..it never worked for me though..
Last edited by mercedes on Wed Dec 03, 2008 8:10 am, edited 1 time in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby ShadowHunter » Wed Dec 03, 2008 8:09 am

Hi Mercedes,

It can be used but you should write ElseIf not Else If :D

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby mercedes » Wed Dec 03, 2008 8:13 am

AHH...ok...cause I know i've tried it ..but probably never noticed that one..:P..lol..I thought that was more C++ language..Ah..Well i will try that..I could have used that many times..but i give up too easily..lol..went with Select Cases..

Thanks for clearing that up for me...:D
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby mercedes » Thu Jan 01, 2009 4:02 am

Hi t here...

Here i'm tring the elseif command again...and it doens' t work for me....with spaces.. without...on one line..or another..just doesn't work for me..

CAn you not use it with "then" like make a whole other statement..same as whats above it...only now with a different argument..i guess..I want them to be able to click the same place...again and have it do something else now..

So

If hotspot(5).visible= True...THen
Actions here..
variable=1
Elseif
Hotspot(5).visible = True Then
different actions
Variable = 0

End if

I basically want them to click the same place...only this time...something else happens..I gather its only for if they don't click it again then....
How can i make it so I can do that then..click it again...once it does something...twice it does something else..then again it goes back to the first one...?..over and over again....which is why i had hoped for else command..

Thanks..!
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Thu Jan 01, 2009 10:46 am

Code: Select all
If hotspot(5).visible=True...Then
Actions here..
variable=1
Else if Hotspot(5).visible=False Then
different actions
Variable = 0

End if


I 've fixed the two lines thing which is wrong and changed the property visible to False to separate the cases

You cant have an else if with the same case!!! If you just want to do something else on second click use a counter variable :wink:
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests