Sliding inventory script.

Started by Molin, Tue 12/08/2003 10:27:05

Previous topic - Next topic

Molin

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

Molin

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...:)

Ishmael

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...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

agsking

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.

Molin

agsking, then try this one it works..

Sirp

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

Gilbert

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);
}
}

sirp

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

Ishmael

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.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk