Gui Problems!

Started by Estaog, Thu 17/06/2004 19:00:08

Previous topic - Next topic

Estaog

See top post for more info. I need help fast.
(Note that i did this thinking that the top post is abbandoned).
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

It could be a problem with the size of the inventory sprites, try using the SetInvDimensions () command. By default, I think it spaces items based on 40 x 22 pixels, whatever their actual size. This would explain the overlap, and the last item getting cut off.

Hope this helps.
I know what you're thinking ... Don't think that.

Estaog

Ok that fixed it, but i now have a scrolling problem:

I put this as a script for the arrows to scroll through the inventory:

if ((button == 6) & (game.top_inv_item < game.num_inv_items - 8))
    game.top_inv_item = game.top_inv_item + 4;
if ((button == 7) & (game.top_inv_item > 0))
    game.top_inv_item = game.top_inv_item - 4;

Whats wrong with it?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

Couple things to check:
  Are the button numbers right?
  Are the buttons set to 'Run Script'?
  Is the Inventory box wide enough for 4 items per row?
  I think it needs to be '&&' not '&'.

Any use?
I know what you're thinking ... Don't think that.

Estaog

Quote from: Ashen on Fri 18/06/2004 14:34:04
Couple things to check:
Ã,  Are the button numbers right? <= yes
Ã,  Are the buttons set to 'Run Script'? <= yes
Ã,  Is the Inventory box wide enough for 4 items per row? <= What does this have to do with it?
Ã,  I think it needs to be '&&' not '&'. <= dosent work

Any use?

Any more suggestions?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

QuoteÃ,  Is the Inventory box wide enough for 4 items per row? <= What does this have to do with it?

Well, you didn't say what your script was / wasn't doing, so I just had to guess at things it might be. Since you use 'game.top_inv_item + 4;' I assumed you wanted 4 items per row.

What is your script doing wrong?

Oh, and make sure you've got all the { and } in the right places. It's quite easy to miss one out or have one too many.
I know what you're thinking ... Don't think that.

Estaog

Well that script actually came with an interface, i want it to be 3 items per rom so il change the 4 to 3 and see if it will work.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

Make sure you change the
if ((button == 6) & (game.top_inv_item < game.num_inv_items - 8 ))
to
if ((button == 6) & (game.top_inv_item < game.num_inv_items - 6))

If it still doesn't work, just copy the script from a default game, and change the button numbers to match.

I know what you're thinking ... Don't think that.

Estaog

I changed it but still, can you explain what does that number stand for maybe i can fix it that way?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

You mean in the line:
  if ((button == 6) & (game.top_inv_item < game.num_inv_items - 6)) ?

As far as I can see, it checks whether the inventory is scrolled as far down as it can be, assuming it displays 2 lines of 3 items (6 items total). If you had a single line inventory, for example, you'd need it to be:
  if ((button == 6) & (game.top_inv_item < game.num_inv_items - 3))

If you've got a 3 line inventory, it'd be - 9, and so on. So, it's the total number of inventory items that can be seen at one time.

The other lines:
    game.top_inv_item = game.top_inv_item - 3;
    game.top_inv_item = game.top_inv_item + 3;
scroll the inventory up or down by one row of 3 items.

The default code in a blank game checks these for you, and might be more use to you.

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;
    }
I know what you're thinking ... Don't think that.

Estaog

    if (button == 3) {   // look
      SetCursorMode(3);
      SetGlobalInt(80,8);
      }
    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;   
    }
 
if (interface == 1) { //The quit gui

  if (button==3) {
    QuitGame (0);
    }
 
  if (button==2) {
    GUIOff (1);
    }
  }
}
}

I put it this code and it works now.
But for some reason the quit gui dosent work now, you click on buttons and they just stand there. Know why?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Ashen

Is that exactly how the script looks? If so I think the problem is that you haven't 'closed off' the inventory GUI interactions, so the quit GUI interactions areÃ,  nestled in the inventory. Basicly, you need to check all the braces ( { & })Ã,  are in the right place:

Ã,  Ã,  if (button == 3) {Ã,  Ã, // look
Ã,  Ã,  Ã,  SetCursorMode(3);
Ã,  Ã,  Ã,  SetGlobalInt(80,8);
Ã,  Ã,  Ã,  } // End of inventory button 3

Ã,  Ã,  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;
Ã,  Ã,  }// End of inventory button 6

Ã,  Ã,  if ((button == 7) && (game.top_inv_item > 0)){
Ã,  Ã,  Ã, // SCROLL UP
Ã,  Ã,  Ã,  game.top_inv_item = game.top_inv_item - game.items_per_line;Ã,  Ã, 
Ã,  Ã,  }// End of inventory button 7

} // End of Inventory GUI

if (interface == 1) { //The quit gui

Ã,  if (button==3) {
Ã,  Ã,  QuitGame (0);
Ã,  } // End of Quit button 3
Ã, 
Ã,  if (button==2) {
Ã,  Ã,  GUIOff (1);
Ã,  } // End of Quit button 2

} // End of Quit GUI

Ã,  // Other GUIs can go here

} //End of interface_click

Also, the obvious - check button numbers, GUI name / number, etc.
I know what you're thinking ... Don't think that.

Estaog

That fixed it, thanks a lot.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

SMF spam blocked by CleanTalk