Need help changing images in hotspots with scripting

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

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

Need help changing images in hotspots with scripting

Postby jack8135 » Sun Jun 17, 2012 12:16 am

Hello All,
I was wondering if anyone could help me with a problem I?m having creating a custom inventory. The inventory has 15 item slots (HotSpots) that can hold different items at various points in the game. For instance HotSpot 7 holds an item called ?empty vial? then, when the player adds liquid to it, HotSpot 7 will hold a new item called ?vial of liquid?. There are separate images for each item. Rather than stack several hotspots on top of each other I want to just change the image using scripting. My dilemma is I can?t figure out the scripting?

Here is what I have tried:

Code: Select all
If Action.GetCurrentFrameName = "inventory" Then
      If got vial empty = 1 Then Action.LoadAPicture Hotspot(7) "empty vial.gif"
   End If
If Action.GetCurrentFrameName = "inventory" Then
      If got vial of liquid = 1 Then Action.LoadAPicture Hotspot(7) "vial of liquid.gif"
   End If


But this comes back with the error ?Expected Then?.
Can someone explain how I can pull this off? It is possible isn?t it?
User avatar
jack8135
Member
 
Posts: 26
Joined: Sat Feb 05, 2011 8:12 am

Postby reneuend » Sun Jun 17, 2012 4:08 am

Change the code to be more efficient. Also, variable names can't have spaces. I used underscores instead.


Code: Select all
       

If Action.GetCurrentFrameName = "inventory" Then
    If got_vial_empty = 1 Then
        Action.LoadAPicture Hotspot(7) "empty vial.gif"
    ElseIf got_vial_of_liquid = 1 Then
        Action.LoadAPicture Hotspot(7) "vial of liquid.gif"
    End If
End If
---


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

Postby jack8135 » Sun Jun 17, 2012 4:49 am

reneuend,

Thank you for the response :D
I copied and pasted the code you supplied and then changed the variables so they have underscores but now when I hit "Apply" it has the error message Expected End of Statement.

Any ideas?

Thanks for the Help!
User avatar
jack8135
Member
 
Posts: 26
Joined: Sat Feb 05, 2011 8:12 am

Postby reneuend » Sun Jun 17, 2012 5:06 am

Oh!!! You need commas after the 1st parameter for the Action.LoadAPicture call.

Code: Select all
Action.LoadAPicture Hotspot(7), "empty vial.gif"



Code: Select all
Action.LoadAPicture Hotspot(7), "vial of liquid.gif"



Code: Select all
If Action.GetCurrentFrameName = "inventory" Then
    If got_vial_empty = 1 Then
        Action.LoadAPicture Hotspot(7), "empty vial.gif"
    ElseIf got_vial_of_liquid = 1 Then
        Action.LoadAPicture Hotspot(7), "vial of liquid.gif"
    End If
End If
---


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

Postby jack8135 » Sun Jun 17, 2012 11:06 pm

Thank you so much! :D
You've been a tremendous help both in the forums and with tutorials. You can expect to see a huge thank you in my game credits :wink:

Peace!
User avatar
jack8135
Member
 
Posts: 26
Joined: Sat Feb 05, 2011 8:12 am


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests