Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: skuttleman on Sat 14/06/2008 21:33:56

Title: import/export GUI so the code is retained.
Post by: skuttleman on Sat 14/06/2008 21:33:56
Is thre a way to export a GUI so that I can import it and it will retain the global script code associated with it? (on_click etc.)

If so, how? If no, why?
Title: Re: import/export GUI so the code is retained.
Post by: Ubel on Sat 14/06/2008 22:48:18
When you export and import a GUI it should automatically contain all the scripts and graphics associated with it. If it doesn't then something's wrong or I'm missing something.
Title: Re: import/export GUI so the code is retained.
Post by: skuttleman on Sat 14/06/2008 23:04:55
Quote from: Pablo on Sat 14/06/2008 22:48:18
When you export and import a GUI it should automatically contain all the scripts and graphics associated with it. If it doesn't then something's wrong or I'm missing something.

When I do it. It retains the graphics, not the scripts.
Title: Re: import/export GUI so the code is retained.
Post by: GarageGothic on Sun 15/06/2008 00:47:26
Yeah, I was pretty sure it saved the scripts too - otherwise what would be the point? But I just tried it out, and skuttleman is right, the linked scripts are not imported. Could this be a bug in the new AGS versions?
Title: Re: import/export GUI so the code is retained.
Post by: Pumaman on Sun 15/06/2008 20:08:35
Sounds like a reasonable request for a future version, if others would find it useful?
Title: Re: import/export GUI so the code is retained.
Post by: GarageGothic on Sun 15/06/2008 20:16:14
It would definitely be useful. But perhaps a cleaner way would be if you could link a GUI to a module, so you can access its scripts without importing them in the module header first (GUI scipts rarely need to be accessed from anywhere else than the referring GUI item)? If you just want to test out a couple of custom GUIs for your game it could be a pain to find and remove all the scripts in the global script once you remove it. I'm myself modulizing pretty much all my code now, because the global script was getting to be a mess.

For instance, if my lightmap module has two debug GUIs, I could link them both to the LightMap module script (by specifying its name in the GUI properties). The GUI events would then refer to functions in the module script instead of the global script. In case a developer exports a GUI containing references to the global script, these could then be automatically compiled to a module with the same name as the GUI and distributed alongside it.
Title: Re: import/export GUI so the code is retained.
Post by: monkey0506 on Tue 17/06/2008 02:10:37
I was fairly certain the code has always been retained... :o

Although actually I quite like GG's suggestion there.
Title: Re: import/export GUI so the code is retained.
Post by: Lt. Smash on Tue 17/06/2008 10:39:02
I also think that codes for guis should be seperated.
Room events (also hotspot, object events) could also be rearanged everytime I add a new event.
F.e.
You have:

function room_RepExec()
{

}

function hHotspot1_Look()
{

}


and now you add room_FirstLoad()
Oh you remember you want to add a Hotspot_Interaction.
after some time it will look like this:

function room_RepExec()
{

}

function room_FirstLoad()
{

}

function hHotspot1_Look()
{

}

function hHotspot1_Interact()
{

}

function room_Load()
{

}

function room_AfterFadeIn()
{

}

function objObject_Look()
{

}

function objObject_UseInv()
{

}

now wouldn't it be nice to have:

#sectionstart ROOM
function room_AfterFadeIn()
{

}

function room_Load()
{

}

function room_FirstLoad()
{

}

function room_RepExec()
{

}
#sectionend ROOM

#sectionstart HOTSPOT1
function hHotspot1_Look()
{

}

function hHotspot1_Interact()
{

}
#sectionend HOTSPOT1

#sectionstart OBJECT
function objObject_Look()
{

}

function objObject_UseInv()
{

}
#sectionend OBJECT

updating and rearranging automatically if you add a new event.