mouse hover and run frames merging

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

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

mouse hover and run frames merging

Postby jack8135 » Wed Feb 09, 2011 10:32 am

hello,
new here so bare with me..

I am trying to make a nice user interface by having a frame called "interface" with hot spot buttons that glow when you hover over them. I have merged this frame with all other frames.

I managed to accomplish this quite nicely thanks to Shadowhunter's keyguard plugin and some amazing tutorials I have found on these forums.

My problem is - when I load or test one of the frames other then "interface" weird things begin to happen. Mainly, the wrong thumbnail will appear when hovering over the hot spots or the hot spot will disappear all together when the mouse cursor leaves it.

I know very little about code and have been getting by with copying and pasting then altering the names/numbers of frames and hot spots but here is my VBScript Global Procedures:

Code: Select all
Sub KeyGuard_MouseLeavesHotSpot(HotspotTAG)
'MsgBox "Mouse leaves hotspot area: " & HotspotTAG(0)

Action.LoadAPicture Hotspot(5), ""
Action.LoadAPicture Hotspot(6), ""
Action.LoadAPicture Hotspot(7), ""
Action.LoadAPicture Hotspot(8), ""
Action.LoadAPicture Hotspot(15), ""
Action.LoadAPicture Hotspot(16), ""
Action.LoadAPicture Hotspot(17), ""
Action.LoadAPicture Hotspot(18), ""
Action.LoadAPicture Hotspot(19), ""


End Sub

Sub KeyGuard_MouseEntersHotSpot(HotspotTAG)
'MsgBox "Mouse enters hotspot area: " & HotspotTAG (0)

If HotSpotTag (0) = 1 Then
Action.LoadAPicture Hotspot(8), "book glow.jpg"
End If
If HotSpotTag (0) = 2 Then
Action.LoadAPicture Hotspot(7), "apple glow.jpg"
End If
If HotSpotTag (0) = 3 Then
Action.LoadAPicture Hotspot(6), "map glow.jpg"
End If
If HotSpotTag (0) = 4 Then
Action.LoadAPicture Hotspot(5), "backpack glow.jpg"
End If
If HotSpotTag (0) = 10 Then
Action.LoadAPicture Hotspot(15), "exit.jpg"
End If
If HotSpotTag (0) = 11 Then
Action.LoadAPicture Hotspot(16), "look button.jpg"
End If
If HotSpotTag (0) = 12 Then
Action.LoadAPicture Hotspot(17), "plus hand button.jpg"
End If
If HotSpotTag (0) = 13 Then
Action.LoadAPicture Hotspot(18), "magnifying glass button.jpg"
End If
If HotSpotTag (0) = 14 Then
Action.LoadAPicture Hotspot(19), "arrow button.jpg"
End If


End Sub

and here is my VBScript code:
'Clear hotspots for this frame
Component("KeyGuard").Object.ClearHotSpots

'Hotspot definitions for buttons
Component("KeyGuard").Object.DefineHotSpot 560,379,70,66,1,0
Component("KeyGuard").Object.DefineHotSpot 560,276,70,52,2,0
Component("KeyGuard").Object.DefineHotSpot 560,173,70,55,3,0
Component("KeyGuard").Object.DefineHotspot 560,71,70,65,4,0
Component("KeyGuard").Object.DefineHotSpot 330,77,69,44,10,0
Component("KeyGuard").Object.DefineHotSpot 415,84,30,30,11,0
Component("KeyGuard").Object.DefineHotSpot 468,84,30,30,12,0
Component("KeyGuard").Object.DefineHotSpot 521,84,30,30,13,0
Component("KeyGuard").Object.DefineHotSpot 580,84,20,30,14,0

'Hotspot definitions for main image
Component("KeyGuard").Object.DefineHotSpot 560,71,70,66,5,0
Component("KeyGuard").Object.DefineHotSpot 560,173,70,52,6,0
Component("KeyGuard").Object.DefineHotSpot 560,276,70,55,7,0
Component("KeyGuard").Object.DefineHotSpot 560,379,70,65,8,0
Component("KeyGuard").Object.DefineHotSpot 330,77,69,44,15,0
Component("KeyGuard").Object.DefineHotSpot 415,84,30,30,16,0
Component("KeyGuard").Object.DefineHotSpot 468,84,30,30,17,0
Component("KeyGuard").Object.DefineHotSpot 521,84,30,30,18,0
Component("KeyGuard").Object.DefineHotSpot 580,84,20,30,19,0


can someone please help me make sense of this?
User avatar
jack8135
Member
 
Posts: 26
Joined: Sat Feb 05, 2011 8:12 am

Postby jack8135 » Wed Feb 09, 2011 10:33 am

ok, not sure why there emotes in some of the places numbers should be...

bare with me, I'm new.
User avatar
jack8135
Member
 
Posts: 26
Joined: Sat Feb 05, 2011 8:12 am

Postby juhuwoorps » Wed Feb 09, 2011 10:46 am

If you are using Merging Frames, the numbers of the hotspots are changing if you have also hotspots in the frame you merged with your interface.

If you are starting a merged frame, first the hotspots in the frame are counted and then the hotspots from the merged frame(interface).

GetMergedHotspotIndex is your friend :)


http://adventuremaker.com/help/vbscript_reference.htm
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby Candle » Wed Feb 09, 2011 6:23 pm

use the code box for any code you paste.
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby jack8135 » Wed Feb 09, 2011 7:28 pm

Juhuwoorps, where would I insert GetMergedHotspotIndex at?

Candle, no problem, sorry about that.

I had thought about unmerging "interface" and just duplicating it when I want a new frame. All I would have to do is change the frame image and add the hotspots I want. My concerns are 1. That's going to be a lot of hotspots to manage for each frame since "interface" will have over 50 hotspots associated with it and 2. Will my final finished game be bogged down or buggy due to the amount activity going on in each frame?
User avatar
jack8135
Member
 
Posts: 26
Joined: Sat Feb 05, 2011 8:12 am

Postby juhuwoorps » Wed Feb 09, 2011 10:28 pm

You have to use GetMergedHotspotIndex in your EntersHotspot and leaves hotspot subs.

For example:

This is your code:
Code: Select all
If HotSpotTag (0) = 1 Then
Action.LoadAPicture Hotspot(8), "book glow.jpg"
End If
If HotSpotTag (0) = 2 Then
Action.LoadAPicture Hotspot(7), "apple glow.jpg"
End If


Change it to:

Code: Select all
If HotSpotTag (0) = 1 Then
Action.LoadAPicture Hotspot(GetMergedHotspotIndex+7), "book glow.jpg"
End If
If HotSpotTag (0) = 2 Then
Action.LoadAPicture Hotspot(GetMergedHotspotIndex+6), "apple glow.jpg"
End If



The best thing you can do is to make a small project with just a few HS to get the feeling how to use Merging frames.
If you need more help just let me know
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Thu Feb 10, 2011 12:28 am

Have you used Hotspot Magic before? It's not just for grids of hotspots. I would recommend trying it out.
---


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


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron