Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Molin on Tue 12/08/2003 10:27:05

Title: Sliding inventory script.
Post by: Molin on Tue 12/08/2003 10:27:05
Hi all.
im new to this editor.
THis is my first script that some might find useful.. Its a function to make a scroll down inventory similiar to that in Beneath a steel sky...
For this particular script to work without modding it you have to set the inventory height to 23.

//in game start;
SetGUIPosition(2,0,-22);

// <DM> define ui timer
int timer = -22; //timer equals the ui height -1

in repeatedly_execute;
// put anything you want to happen every game cycle here

// <DM> UI slidedown
if (mouse.y <= (timer+23))
{
 if (timer <= -1) {
   timer++; SetGUIPosition(2,0,timer);
 }
}
// <DM> UI slideup
else
{
 if (timer >= -22) {
   timer--; SetGUIPosition(2,0,timer);
 }
}

Nothing much but  a start for me anyways....
/Molin
Title: Re:Sliding inventory script.
Post by: Molin on Tue 12/08/2003 10:48:57
also let me just add that its pretty simple to make use of SetGUITransparency() to fade in/out the ui when it drops in/out.

nice!, this is fun...:)
Title: Re:Sliding inventory script.
Post by: Ishmael on Thu 14/08/2003 19:17:55
I like the idea! I was up to that kind of GUI for game options (save, load, settings, quit) some time ago, but dropped it because it didn't work, because of my lack of scripting creativity...
Title: Re:Sliding inventory script.
Post by: agsking on Thu 14/08/2003 19:40:54
Good idea. I was working on something similar but it was crap so I abandoned it. A BASS type inventory is hard to script IMO.
Title: Re:Sliding inventory script.
Post by: Molin on Thu 14/08/2003 20:43:31
agsking, then try this one it works..
Title: Re:Sliding inventory script.
Post by: on Tue 04/11/2003 03:43:13
hey! i tried your inventory slider but it doesn't works, it says:
"error:SetGUIPosition : Invalid GUI number"
i don't understand though i have some knowledge in programming,
i really not good at it, haha!! especially when it's someone else's work!
if you could help me, i'd enjoy it you tell how to make this thing work !!
thx
Title: Re:Sliding inventory script.
Post by: Gilbert on Tue 04/11/2003 04:13:46
Because you have to substitute the GUI numbers in the codes with the correct number of your GUI which you want to have this effect. The example code uses GUI2, if there's no GUI #2 in your game, there'll be an error.

Just check from the GUI screen of AGSedit the desired number and replace the red 2's from the following code:

//in game start;
SetGUIPosition(2,0,-22);

// <DM> define ui timer
int timer = -22; //timer equals the ui height -1

in repeatedly_execute;
// put anything you want to happen every game cycle here

// <DM> UI slidedown
if (mouse.y <= (timer+23))
{
if (timer <= -1) {
timer++; SetGUIPosition(2,0,timer);
}
}
// <DM> UI slideup
else
{
if (timer >= -22) {
timer--; SetGUIPosition(2,0,timer);
}
}
Title: Re:Sliding inventory script.
Post by: on Fri 07/11/2003 21:40:31
do i have to create a new gui for the inventory windows or does it use the default inventory window ? if so how can i modify the default inventory window ? i know its a lot of question but i've always had difficulty with my inventory hehe
Title: Re:Sliding inventory script.
Post by: Ishmael on Sat 08/11/2003 11:56:42
Depends on which default inventory screen you mean. If you're talking about the build-in Sierra interface, you need a new GUI, if you mean the custom inv, you can just rebuild it.