Different Functions, Same Button

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

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

Different Functions, Same Button

Postby JasonMc » Mon Jul 12, 2010 3:28 am

I have a help button on the toolbar I'm working on (which will be shared using Runtime Frames Merging). I need to program this button to show a help message on each page, but here is the problem...each page needs a different help message!

I was thinking that what I would do is have a procedure that will call a different ' Action.Message "MESSAGE_TEXT" ' on each frame.

This is what I tried for the procedure.

Code: Select all
sub HELP
If Frame = 1 then Action.Message "This is message 1"
If Frame = 2 then Action.Message "This is message 2"
End Sub


I simply put "HELP" for the VBScript for this button.

I got this error message when I tested it on Frame "1" (yes, I use numbers for the game frames)

Error executing script.

The scripting engine returned the following error message.

Wrong number of arguments or invalid property assignment "HELP"


I'm sure I'm doing something wrong. Can anyone help?
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby juhuwoorps » Mon Jul 12, 2010 4:08 am

Code: Select all
sub HELP
Frame=GetCurrentFrameName
If Frame = "1"  then Action.Message "This is message 1"
If Frame = "2"  then Action.Message "This is message 2"
End Sub


This should work
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Mon Jul 12, 2010 4:39 am

Juhu is right. But if you have a lot of frames, then you might want to use a select statement:

Code: Select all
Select Case (frame)
    Case "frame1":
        Message = "This is frame1"
    Case "frame2":
        Message = "This is frame2"
    Case "frame100"
        Message="This is frame100"
End Select
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby JasonMc » Mon Jul 12, 2010 4:54 am

You guys SO ROCK!!!! Thank you! :D :D :D 8) 8) 8)

EDIT: Hey, umm, I'm still getting the same error message. What do I need to put for the VBScript action on the help button?
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby Mystery » Mon Jul 12, 2010 5:17 am

You did correctly when you added
HELP
in the Advanced Tab of the help button hotspot.
It should work.

What exactly did you add in the VBS Procedures window?
Maybe there is a small mistake that you've made :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby JasonMc » Mon Jul 12, 2010 5:29 am

Code: Select all
sub HELP
Frame=GetCurrentFrameName
If Frame = "1"  then Action.Message "This is message 1"
If Frame = "2"  then Action.Message "This is message 2"
End Sub
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby reneuend » Mon Jul 12, 2010 5:31 am

sub HELP()

.....

end sub

- be sure to add the parenthesis to the formal declaration of the subroutine.
- other possibility is that HELP is a reserved subroutine in VBscript. If so, change the name of your subroutine to something like: displayHelp()
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby JasonMc » Mon Jul 12, 2010 5:34 am

WOAH! Thank you. :D Slowly, but surely, I'm getting this working. Thank you!!!

And, yes, HELP is reserved. I changed it to SHOWHELP.
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby Mystery » Mon Jul 12, 2010 5:50 am

JasonMc wrote:
Code: Select all
sub HELP
Frame=GetCurrentFrameName
If Frame = "1"  then Action.Message "This is message 1"
If Frame = "2"  then Action.Message "This is message 2"
End Sub


It's interesting, I just copy-pasted this code and tried myself as it is, and it works for me 8)

And also the Select case works for me:

Code: Select all
sub HELP
frame=GetCurrentFrameName
Select Case frame
    Case "1":
    Message "This is frame1"
    Case "2":
    Message "This is frame2"
End Select
End Sub
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby JasonMc » Mon Jul 12, 2010 5:58 am

Hmm, maybe its my end. Either way, I've got it working. It'll be a very handy game function, I think.

Boy, when I finish this toolbar, I should post a tutorial (with thank yous to all you awesome programmers!)
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Postby Mystery » Mon Jul 12, 2010 6:06 am

Well, what counts after all is that you made it to work :)

(I was just wondering why it didn't work for you but did for me - such computer mysteries always amaze me :lol: )
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby JasonMc » Mon Jul 12, 2010 6:10 am

Well, that partly explains the screenname...:)
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron