Announcement

Collapse
No announcement yet.

Previous and Next buttons in Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Previous and Next buttons in Widget

    Hey Everyone

    Probably real simple, but at the moment, it's just not coming to me.

    I have an Int array that has 10 indexes. In a widget, I have '+' and '-' buttons which I want to use to cycle through each index in the array starting at 0.

    I'm having some trouble figuring it out and am hoping someone here is able to help me.

    Thanks.

    #2
    There's more than one way to do it, I usually settle for this:

    Click image for larger version  Name:	Capture.PNG Views:	1 Size:	92.2 KB ID:	1626876

    This will work with any array size. You may want to catch an exception for an empty array, though - as it makes no sense to run the script when no elements are present, and it will incorrectly return index 0.

    Comment


      #3
      Thanks for this. It's basically for an Inventory where a widget pops up where the player can drop a certain amount of an item. The array will never be empty in my case as it won't even get this far unless there are more than 1 items to drop.

      I'll give this one a shot. Thanks heaps.

      Comment

      Working...
      X