Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: multi007 on Wed 23/11/2022 18:40:28

Title: Clearing Hotspots
Post by: multi007 on Wed 23/11/2022 18:40:28
I just screwed up my entire room script for Hotspots only... luckily I only have 2 rooms but somehow both scripts in both rooms got so messed up so i just deleted the entire hotspot scripts.

So now I have the hotspot drop downs (in the room details field where the hotspot, walkable areas, and erasers are) that still have the titles i assigned.  I tried to do it over again but its almost like I need to clear the entire hotspot file on my pc to start my hotspots new again.

Is there a way to clear the entire hotspot folder so I can start new hotspots all over again?

Thanks
Title: Re: Clearing Hotspots
Post by: Snarky on Wed 23/11/2022 19:16:15
Please start a new thread for new questions, so that each thread deals with one technical issue and so the thread title describes the problem. I have split your post off into a new thread.

There isn't really a "hotspot folder" or file anywhere. The properties (ID/name and events) are stored in the game.xml file, the masks inside a big binary blob (in AGS 4.0 they will be stored as separate image files in a folder, I believe), and the event code in the room scripts. By deleting these in the editor, you should be able to "reset" it. If you're having trouble, please describe what is happening in detail.
Title: Re: Clearing Hotspots
Post by: heltenjon on Wed 23/11/2022 23:49:32
If I'm understanding you correctly, you deleted the room script pointing to hotspots, thinking that would erase the hotspots. But in order to do so, you have to use the menus in the editor, or else whatever you have set up under the lightning bolt (like left click on hotspot) will try to find the script you have deleted.
Title: Re: Clearing Hotspots
Post by: Khris on Thu 24/11/2022 13:27:49
If you deleted just the functions in the room script, getting back on track simply means to recreate those.
The rest (script name, description, drawn area, etc.) is stored in the room file and should be untouched.

So instead of starting from scratch, simply select each hotspot in the editor, go to the events panel by clicking the thunderbolt icon, then for each event that has a function name next to it: clear the text field, then click the ellipses button to recreate the function.

Also note that if by screwing up you're referring mostly to mismatched curly braces, note that you can quickly find problems with those by copy-pasting your entire script into the lower left box here: https://jsfiddle.net/ and clicking Tidy in the corner. This will auto-format your script (JS is close enough to AGScript) and immediately show braces issues via bad indentation.
Title: Re: Clearing Hotspots
Post by: multi007 on Thu 24/11/2022 16:18:50
thank you all - i'll check out your suggestions once family leaves after the weekend. 

Snarky - sorry about that and will do in the future.
Title: Re: Clearing Hotspots
Post by: multi007 on Sun 27/11/2022 14:26:35
 (never again will this happen - i'll back up the files regularly from now on).

tried recreating the script - now when I run the game, I get this error window.

"Internal error occurred"  ACI version 3.5.1.19

Error: Prepare_script: error - 18 (no such function in script)
trying to run "exit to lake" (Room 1)

Here's my room 1 script

 // room script file
function hExit_WalkOn()
{
  player.ChangeRoomAutoPosition(2);
}


Here's my hotpot window details

Description Exit To Lake
Name   hExitToLake

 
Here's my room 2 script

 // room script file
function hExit_WalkOn()
{
  player.ChangeRoomAutoPosition(2);
 
}

Here's my hotpot window details

Description Exit to Cabin
Name hExitToLake


Any help is appreciated.
Title: Re: Clearing Hotspots
Post by: eri0o on Sun 27/11/2022 14:46:41
It looks like the hotspot hExitToLake (or some other other thing) has an event that in the Editor is linked to a function named "exit to lake" but the function in room script is named hExit_WalkOn, so either go to the event panel of that hotspot (or some other) and delete the linked event "exit to lake" and click the three dots to create a new event in room script or if hExit_WalkOn is the intended function use that name - or if no such function is intended just leave it blank.
Title: Re: Clearing Hotspots
Post by: Khris on Sun 27/11/2022 15:01:16
Indeed, don't type random words into the event table. Whatever it says next to "Stands on hotspot" (which is the legacy event  I assume you have used) is supposed to match the name of a room script function exactly, to the letter. As such it definitely cannot include spaces, but you're not really supposed to manually type something in there anyway unless you know exactly what you're doing.

(https://i.imgur.com/iMQaemy.png)

So again:
Quoteclear the text field, then click the ellipses button to recreate the function

(also: use a region and its "walks onto" event instead)
Title: Re: Clearing Hotspots
Post by: multi007 on Sun 27/11/2022 15:14:41
Thanks eri and Kris

"Whatever it says next to "Stands on hotspot" (which is the legacy event  I assume you have used) is supposed to match the name of a room script function exactly, to the letter."

I did NOT know this...  Let me play around with it and I'll post an update.