An inventory gui, how?

Started by the_graver, Sat 27/09/2003 03:23:52

Previous topic - Next topic

the_graver

i'v did an inventori gui in the left side of the screen and I just can't see there my inventory during the game...
how do I do that?

and one more question:
how do I make that same gui dissappear when I'm not on it?
i'v tried the "mouse Ypos"
but I want it a "mouse Xpos" and there is no such thing there, and where do I see those cordinats in the script?
please help me...
In thank:
The_graver!
The_Graver games

Ishmael

The inventory should appear on the custom GUI... You sure you addad a inventory window to it, and it is big enough, and you have inventory items?

For the disappearing/appearing inv:

Lets say we have inventory window 40 pixels wide, 200/240 high, resolution dependant. (and a 320x200 game, in the case). Try this:

Into Global Script:

int invx, invopen;

function repeadetly_execute() {
 if ((mouse.x < 20) && (invopen == 0)) {
   while (invx < 0) {
     invx++;
     SetGUIPosition(INV,invx,0);
     Wait(1);
   }
   invopen = 1;
 } else if ((mouse.x > 40) && (invopen == 1)) {
   while (invx < -40) {
     invx--;
     SetGUIPosition(INV,invx,0);
     Wait(1);
   }
   invopen = 0;
 }
}

Does that work?
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.

the_graver

Quote from: TK on Sat 27/09/2003 13:22:56
The inventory should appear on the custom GUI... You sure you addad a inventory window to it, and it is big enough, and you have inventory items?

For the disappearing/appearing inv:

Lets say we have inventory window 40 pixels wide, 200/240 high, resolution dependant. (and a 320x200 game, in the case). Try this:

Into Global Script:

int invx, invopen;

function repeadetly_execute() {
 if ((mouse.x < 20) && (invopen == 0)) {
   while (invx < 0) {
     invx++;
     SetGUIPosition(INV,invx,0);
     Wait(1);
   }
   invopen = 1;
 } else if ((mouse.x > 40) && (invopen == 1)) {
   while (invx < -40) {
     invx--;
     SetGUIPosition(INV,invx,0);
     Wait(1);
   }
   invopen = 0;
 }
}

Does that work?
I did not understand how...
can you plese show me where should I place that screept in the global scripts?
is there a way to do: mouse Xpos in the "visible" insted of: "Ypos"?
The_Graver games

Ishmael

I am a bit irretated by you quoteing whole posts with then next reply.... well, it's none of my business.... so nevermind....

You should place the int declareations at the beginning of the global script, and the other code inside the repeadetly_execute, the first line of it shows:
Code: ags
function repeadetly_execute() {


And drop the last } from it...

Set the GUI to either "Popup Modal" if you want it's appearing to pause the game, or to "normal" if you want it to not. Set the GUI's position ot Y 0, X -#, where # is the width of the GUI, and fix it in the script
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.

the_graver

i'v tried and tried and I could not get any thing, it has a problem with this line:
QuoteSetGUIPosition(INV,invx,0);
can you help me?
The_Graver games

Ishmael

What problem it has? It reports an error?
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.

Gilbert

I don't see a declaration to the variable INV, maybe that's the problem.
I don't know what you're going to do, and I'm too lazy to read the whole thing :P , maybe you should just point out where this variable's from.

Ishmael

#7
It is the GUI name ;D Change it to the right one if your inventory GUI isn't named 'INV'. Mine is...
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.

the_graver

Quote from: TK on Mon 29/09/2003 07:12:11
It is the GUI name ;D Change it to the right one if your inventory GUI isn't named 'INV'. Mine is...
OK, the game now works but i'v told you that the gui is in the left, but it is in the right, can you please give me the code for it like this and for the resulution of 800X600, if you canplese do that or at least to tell me what do I need to change.
thank you...
The_Graver games

Ishmael

int invx, invopen;

function repeadetly_execute() {
if ((mouse.x > 780) && (invopen == 0)) {
while (invx > 760) {
invx--;
SetGUIPosition(INV,invx,0);
Wait(1);
}
invopen = 1;
} else if ((mouse.x < 760) && (invopen == 1)) {
while (invx < 800) {
invx++;
SetGUIPosition(INV,invx,0);
Wait(1);
}
invopen = 0;
}
}


Should work
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.

the_graver

Quote from: TK on Tue 30/09/2003 11:45:01

Should work
at first almoust worked but as I go to the position the up gui is being erased and I see the other gui starting sliding away in the top to the right an then it gets an eror with this line:
Quote
SetGUIPosition(SM,invx,0);

and turns off the game.
what do you think the problem is?
The_Graver games

Ishmael

It gives you error about the GUI must place in cordinates 0 - SCREENWIDTH or something?

But anyway, this should do it:

if ((mouse.x > 780) && (invopen == 0)) {
while (invx > 760) {
invx--;
SetGUIPosition(INV,invx,0);
Wait(1);
}
invopen = 1;
} else if ((mouse.x < 760) && (invopen == 1)) {
while (invx < 799) {
invx++;
SetGUIPosition(INV,invx,0);
Wait(1);
}
invopen = 0;
}

GUI's top-left corner can't appearantly be placed ouside of screen...
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.

the_graver

thank you very much for the try  :-* It does'nt work
but now I have done my oun thing if you want to know what it is so ask...
The_Graver games

SMF spam blocked by CleanTalk