Script Accidentally Duplicates Items

Discussion in 'Learning Ruby and RGSSx' started by RoseReveries, Nov 27, 2016.

  1. RoseReveries

    RoseReveries Villager Member

    Messages:
    11
    Likes Received:
    8
    First Language:
    English
    Hi, sorry if this is the wrong place to post this.


    I'm pretty new to scripting, but I've been working on a rune crafting script and have run into a problem. If you have only one rune in your inventory and you select it you're able to select it again for the second rune, essentially duplicating it. I have no idea how to fix it to be honest haha, I was hoping someone here could shed some light on how to fix it.


    Here is a demo that includes my script, I figured it would make more sense this way.


    https://www.dropbox.com/sh/q543pnj9ubixaxs/AACROFmAbeP6W1oxjvI00rgVa?dl=0


    Thanks so much for taking a look.
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,806
    Likes Received:
    11,511
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    I haven't looked at your script, but normally you'd look at how many items you have in inventory, and subtract how many have already been selected, in order to determine what's available.  So you should have a list somewhere of the items already selected and the quantities of each.
     
    #2
  3. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,067
    Location:
    Toronto
    First Language:
    English
    If the idea is


    1: Select a rune,


    2: Select another rune (to combine with, etc)


    You would need to make sure that the second time around, you prevent the user from selecting a rune that is already selected.


    So for example you could keep track of a list of items that have been selected, and then checking whether the selected item is already in the list or not.
     
    #3
  4. RoseReveries

    RoseReveries Villager Member

    Messages:
    11
    Likes Received:
    8
    First Language:
    English
    Thanks guys, I'll give that a shot :D
     
    #4

Share This Page