how do I detect an interaction type?

Started by EnterTheStory (aka tolworthy), Tue 11/11/2008 11:46:57

Previous topic - Next topic

EnterTheStory (aka tolworthy)

All my room hotspots have one of two interaction types: "player go to a different room" or or "run script."

Whenever someone clicks the mouse I run a "tidy up" function, resetting some variables to zero. But I don't want to do that if "run script" is being called (in case those variables are needed). How can I tell which interaction is being called?

Or do I need to go into every hotspot and edit it manually, calling my "tidy up" code separately each time?

GarageGothic

Can't you do the cleaning up in the on_event for eEventLeaveRoom?

EnterTheStory (aka tolworthy)

#2
Quote from: GarageGothic on Tue 11/11/2008 12:24:23
Can't you do the cleaning up in the on_event for eEventLeaveRoom?
No, because that can't tell how the person left the room. If a character left via "player go to a different room" then I need to reset all variables. But if she left via "run script" then I need to preserve the variables for the next room.

GarageGothic

Ah, I didn't realize the player could also leave rooms via the "run script" events. How about adding a custom property (bool) that you set to true for the "player go to a different room" hotspots, and then run your clean-up code in the on_mouse_click for those hotspot before calling RunInteraction?


SSH

You could:

make a ChrisTChangeRoom function which sets a global variable "nocleanup" to 1. Use this in all scripts. Then in your on_event, only cleanup  if nocleanup is 0. Then always reset it to 0 in the on_event handler, too.
12

EnterTheStory (aka tolworthy)

Quote from: SSH on Tue 11/11/2008 17:03:18
You could:

make a ChrisTChangeRoom function which sets a global variable "nocleanup" to 1. Use this in all scripts. Then in your on_event, only cleanup  if nocleanup is 0. Then always reset it to 0 in the on_event handler, too.


Ah, that would work! I don't fancy going through all 700 "normal" hotspots, but it would be much less work to go through the 50 or so "special" hotspots. Thanks.

Which leads to the next question... is there a way to access the code in each hotspot from a script? Name, walkToX, etc., are accessible, but I don't now how to see inside the interaction without opening every single hotspot one at a time and tunneling down the layers of boxes for each one (80 roomx x 10 hotspots on average... and I can't remember which ones have scripts :(

Trent R

#6
You could try a macro program and record the mouse movements and clicks to click the events tab, and the ellipsis button.

Then just use the general definitions pull down at the the top of the script editor. If you're 'correctly' named all of your elements, you can just look for hspot1_Look, hTable_Interact, etc, etc and jump straight to it.


~Trent
PS-One program I've used before was AutoHotKey, and was fairly simple to script it.



Crap. Didn't realize you were still talking about the old editor. I don't know if my advice still applies...

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Pumaman

Quote from: tolworthy on Tue 11/11/2008 18:48:32
Which leads to the next question... is there a way to access the code in each hotspot from a script? Name, walkToX, etc., are accessible, but I don't now how to see inside the interaction without opening every single hotspot one at a time and tunneling down the layers of boxes for each one (80 roomx x 10 hotspots on average... and I can't remember which ones have scripts :(

No, there isn't -- one of the reasons why the interaction editor was scrapped in AGS 3 :)

SMF spam blocked by CleanTalk