Okay, another inventory question, how DO you script scrolling inventory buttons, I cannot fathom it...
Putting YourInvWindow.ScrollUp() resp. YourInvWindow.ScrollDown() in the GUI button scripts should do it.
script is:
Ã, if (interface == INVENTORY) {
Ã, Ã, // They clicked a button on the Inventory GUI
Ã, Ã, if (button == 6) {
Ã, Ã, Ã, 0.ScrollUp();
Ã, Ã, }
Ã, Ã, if (button == 7) {
Ã, Ã, Ã, 0.ScrollDown();
Ã, Ã, }
recieve error:Ã, PEO4 Parse error at "0"
NOTE: "0" is the GUI object inventory window.
You have to give the InvWindows control a name in the editor first. If you want to access it with its number (ID) only, you have to do:
gYourgui.Controls[0].ScrollUp();
or
gui[1].Controls[0].ScrollUp();
if you don't want to use the GUI's name.
Thanks, but yet another error....
if (interface == INVENTORY) {
// They clicked a button on the Inventory GUI
if (button == 6) {
INVENTORY.Controls[0].ScrollUp();
}
if (button == 7) {
INVENTORY.Controls[0].ScrollDown();
}
Unexpected '.' possible missing simicolen.
INVENTORY => gInventory
Edit:
Oh, and I think it's
gInventory.Controls[0].AsInvWindow.ScrollUp();
Edit 2:
But as I said, it's easier to just give the InvWindow a name in the editor, then you can access it directly:
TheInvWindowControlNameYouGaveItInTheEditor.ScrollUp();
I know this is probably a stupid question, but how do you give it a name in the editor ???
You use AGS v2.7, yes?
Go to the "GUIs" pane in the editor, select the InvWindow control and in the small floating window, double-click the "Script name" row.
I have no idea what I'm doing.Ã, Bear with me....
I can't find the InvWindow control, I don't know if it has anything to do with it, but I'm using a Custom Inventory Window called INVENTORY.
I tried the new script, getting error:Ã, gInventory as an undefined token.
NOW!!! AT the worst possible time, yet another problem has sprung up!!! GRRRRRRR I accidently created a second inventory window within GUI INVENTORY, and now all my items appear twice, how do you kill a window?
Quote from: Akumayo on Sun 11/09/2005 20:10:17I can't find the InvWindow control
Well...it's a rectangular-shaped control. When it's selected, the small floating window's title should say "GUI 2 Control 0 (Inventory)" (as opposed to (Button)) or some such.
Quote from: strazer on Sun 11/09/2005 20:03:32You use AGS v2.7, yes?
Meaning, what version of AGS are you using? .ScrollUp and -Down work with AGS v2.7+ only.
Why don't you take a look at the default game (Start new game, select "Default game" template) to see how the scrolling is done there?
Quote from: Akumayo on Sun 11/09/2005 20:10:17I accidently created a second inventory window within GUI INVENTORY, and now all my items appear twice, how do you kill a window?
Select the GUI control, then press the [DEL] key on your keyboard.
Thanks for all your help, I'll look up the default scrolling buttons.
New problem...
Here's the script:
if ((button == 6) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)) {
// scroll down
game.top_inv_item = game.top_inv_item + game.items_per_line;
}
if ((button == 7) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - game.items_per_line;
}
The game will scroll DOWN when I tell it too, but I can't get it to scroll back UP. What am I missing here?
BTW: I'm working off version 6.62
Are you sure you're pressing the correct button (no. 7)? Make sure by putting a
// scroll up
Display("Up pressed");
in there.
I cannot believe I made such a simple mistake!!! :-[
Thanks so much for your help strazer, it all works now!!! My inventory issues are solved! ;D
Cool. :)