trouble using code that display frame name

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

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

trouble using code that display frame name

Postby Peter Pauze » Fri Dec 18, 2009 11:51 pm

Hi there.

On the AM VBScript Tips page the following tip is provided for displaying the frame name:

The following steps will show you how to automatically display the name of the frame on all the frames.

1. Create a new frame, called for example MyStatusBar.
2. Double-click to get to the frame editor.
3. Right-click to create text.
4. Type some text (like "abc", or anything else, it doesn't matter). Place it where you want the name to appear on all the frames. Close the frame.
5. Click the link for Runtime Frames Merging.
6. You must select each frame that you want to merge with the hotspot in the frame. Use <shift> or <ctrl> to select multiples. Next use the pull-down menu to the frame called MyStatusBar.
7. Now each of the frames will share the text box, but they don't know what to do with it. Open the Project Properties, go to the Advanced tab, check the option "Execute some VBScript code every time that a frame is loaded", and type in the following code:

i = Action.GetMergedTextIndex
Text(i).Caption="The current frame is: "+Action.GetCurrentFrameName


I've followed the instructions and it works. Trouble is, my project already has lots of text in it, in pretty much every frame, and this code essentially "takes over" the first text it finds, replacing it with the current frame name.

Can anyone suggest some way to have that coded Action associated with a particular bit of text rather than the first bit of text it happens upon?

Or is there some other way to use this code to display the current frame name? I have many, many hundreds of frames in my project and it sure would help to know what frame I'm on while testing and debugging.

Thanks for any advice.

Peter
Peter Pauze
Member
 
Posts: 22
Joined: Thu Sep 16, 2004 5:53 pm

Postby Mystery » Sat Dec 19, 2009 12:19 am

Have you used any script for the other texts? If so what?

If not, that should not happen. I just did a short test with frames where I have added a few other texts as well, but the frame name is displayed correctly where it should, without "hijacking" other text.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Peter Pauze » Sat Dec 19, 2009 2:38 am

Thank you for taking the time to respond.

I went through and re-did the steps of the instructions and now it works properly. I'm not sure what I did wrong the first time, but obviously I must have made a mistake somewhere along the line.

Sorry to have wasted a post and your time.

PP
Peter Pauze
Member
 
Posts: 22
Joined: Thu Sep 16, 2004 5:53 pm

Postby Mystery » Sat Dec 19, 2009 3:21 am

Indeed, tiny mistakes can have big effects :lol:

Glad to hear that it works now, and no need to be sorry :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Dec 19, 2009 3:44 pm

Maybe you accidentally wrote Text(1) instead of text(i)


Anyway, always remember that there's a text(0) (zero subscript) that isn't used by the program and you are free to use it in any code you wish, just remember to make it visible
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