Changing the cursor by right clicking (Scripting)

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

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

Changing the cursor by right clicking (Scripting)

Postby Lyberodoggy » Thu May 15, 2008 2:08 pm

After hours of trying to create a custom inventory, I put that aside to present another trick.

Before half an hour, I accidentaly discovered the function of AM that lets you assign another function to the right click instead of bringing up the menu.

At that time I had the idea of creating a code to change the cursor every time the player wants to examine something (for example see Runaway).

So, here is the way to do so.
1. Go to variables, create a variant variable called mode
2. Create a blank frame named mode. Create a text and a hotspot in it. In the text write Action. Make the Hotspot appear as a hand and import the magnifier from the icons to the directory of the hotspot apearance's pictures.
3. Go to Project properties -> Advanced and select the checkbox at the bottom. Paste this code in it:


Code: Select all
If mode="Action" Then
mode="Search"
Action.ChangeDefaultCursor "magnifier.ico"
icontouse="magnifier.ico"
Else
mode="Action"
Action.ChangeDefaultCursor ""
Action.GoToFrame Action.GetCurrentFrameName
IcontoUse="Action2.ico"
End If
Text(Action.GetMergedTextIndex).Caption=mode
Action.LoadAPicture Hotspot(Action.GetMergedHotspotIndex), IconToUse

4. At the other two checkboxes, write this code:
Code: Select all
mode="Action"

5. Go to your project's frames. Merge them with the frame named mode.
Then create hotspots and make them perform their actions with scripting like this:

Code: Select all
If mode="Action" Then
Action.GoToFrame "Solid01"
Else
Action.message "What a nice door!"
End If

Or create another variable and make it 0 if mode="Action" or 1 if mode= "Search", then create different hotspots for the two modes and make them visible or not depending on the variable.


Hope you will use this.
Attachments
Change Cursor Right Click.zip
Sample Project
(279.82 KiB) Downloaded 346 times
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Thu May 15, 2008 3:40 pm

Thanks, sounds interesting! :D

(Btw, I've been working on a custom inventory, too - no presentable results yet, just a beginning :lol: )
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Candle » Thu May 15, 2008 4:46 pm

looks cool, i tried it out .
How will you do the menu so you can quit the game with the right click?
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: 3051
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Lyberodoggy » Thu May 15, 2008 5:50 pm

Just merge another frame with a text and a hotspot and make it so that it takes you to a custom menu with save/load/exit game features.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Thu May 15, 2008 8:35 pm

Great, can I include it in my 100 Visual Basic Techniques? I will give you full credit... :D
_________________
Dominican Republic Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:23 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Fri May 16, 2008 9:06 am

Of course!
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Mon May 19, 2008 2:12 pm

Okay, it's technique 33, but since I'm only releasing 1 - 30 in the next update, we'll have to wait in order to see it there...
_________________
Lukumi Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:24 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Mon May 19, 2008 3:46 pm

Waiting :D
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

More than 2 cursors

Postby Ostp » Sun May 25, 2008 11:09 pm

Thanks! This is great!

How would I go about using this technique to incorporate more than two cursor icons (Look, Use, Talk)? I'm not well-versed in VBS, and the attempts I've made to figure out how to do this have failed, so any help would be appreciated.

Thanks.
Ostp
New Member
 
Posts: 2
Joined: Sun May 25, 2008 10:53 pm

Postby Lyberodoggy » Mon May 26, 2008 7:06 pm

Hello Ostp, welcome to the Forums...
there's a nice plugin to do what you want called Simple Menu, you should definitely try it.

To use this method with other features too you need to configure the code given accordingly. Example:

Code: Select all
If mode="Action" Then
mode="Search"
Action.ChangeDefaultCursor "magnifier.ico"
icontouse="magnifier.ico"
Else if mode="Search" then
mode="Something Else"
Action.ChangeDefaultCursor "anothericon.ico"
icontouse="anothericon.ico"
else
mode="Action"
Action.ChangeDefaultCursor ""
Action.GoToFrame Action.GetCurrentFrameName
IcontoUse="Action2.ico"
End If
End if 'double end here
Text(Action.GetMergedTextIndex).Caption=mode
Action.LoadAPicture Hotspot(Action.GetMergedHotspotIndex), IconToUse
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron