Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old April 8th, 2013 (12:58 PM). Edited April 9th, 2013 by Black Eternity.
Black Eternity's Avatar
Black Eternity Black Eternity is offline
Lord of Eternity
     
    Join Date: Sep 2012
    Age: 24
    Gender: Male
    Posts: 59
    #This post has been edited since the script has been completed to my standards.
    #Thanks to Maruno for help

    The full script is here: http://www.pokecommunity.com/showthread.php?t=299771


    This is the old post
    Spoiler:
    Okay so I'm working on adding a simple bank script for players to store extra money.
    My problem is that I can't get the game to recognize my variable.
    I can deposit money, but it does not add to the bank ($game_variables[014])
    and I cannot withdraw, as I always get the "IF" statement since it does not update.

    Can anyone help me with my script?
    Code:
    #This script is for storing the players money in a bank.
    
    def pbDepositBank
      if $Trainer.money=MINDEPOSIT
        params=ChooseNumberParams.new
        params.setMaxDigits(6)
        params.setRange(MINDEPOSIT,$Trainer.money)
        params.setCancelValue(0)
        qty=Kernel.pbMessageChooseNumber(
          _INTL("How much would you like to deposit?"),params)
        $game_variables[014]=$game_variables[014]+qty
        $Trainer.money=$Trainer.money-qty
      end
    end
    
    def pbWithdrawBank
      if $game_variables[014]==0
          Kernel.pbMessage(
            _INTL("You do not have any money to withdraw"))
      else $game_variables[014]>=1
        params=ChooseNumberParams.new
        params.setMaxDigits(6)
        params.setRange(1,$game_variables[014])
        params.setCancelValue(0)
        qty=Kernel.pbMessage(
          _INTL("How much would you like to withdraw?"),params)
        $game_variables[014]=$game_variables[014]-qty
        $Trainer.money=$Trainer.money+qty
      end
    end
    Reply With Quote

    Relevant Advertising!

      #2    
    Old April 8th, 2013 (2:16 PM).
    Maruno's Avatar
    Maruno Maruno is offline
    Lead Dev of Pokémon Essentials
       
      Join Date: Jan 2008
      Location: England
      Posts: 5,180
      You put else rather than elsif. See if that works.
      __________________
      Go to the Pokémon Essentials Wiki

      | Downloads | Tutorials | Fangames |
      | All Animations Project |

      Follow me on Twitter: @maruno42


      Reply With Quote
        #3    
      Old April 8th, 2013 (2:20 PM).
      Black Eternity's Avatar
      Black Eternity Black Eternity is offline
      Lord of Eternity
         
        Join Date: Sep 2012
        Age: 24
        Gender: Male
        Posts: 59
        Unfortunately I get the same result, even if I set $game_variables[014] to any number via the debug menu, the script does not recognize it.
        __________________

        [Pokemon Essentials Scripts]
        Banking System: Here
        Berry Trading System: Here
        Reply With Quote
          #4    
        Old April 8th, 2013 (2:35 PM).
        Maruno's Avatar
        Maruno Maruno is offline
        Lead Dev of Pokémon Essentials
           
          Join Date: Jan 2008
          Location: England
          Posts: 5,180
          Where is MINDEPOSIT set?

          In pbWithdrawBank, you need to use Kernel.pbMessageChooseNumber when choosing the number.
          __________________
          Go to the Pokémon Essentials Wiki

          | Downloads | Tutorials | Fangames |
          | All Animations Project |

          Follow me on Twitter: @maruno42


          Reply With Quote
            #5    
          Old April 8th, 2013 (2:57 PM).
          Black Eternity's Avatar
          Black Eternity Black Eternity is offline
          Lord of Eternity
             
            Join Date: Sep 2012
            Age: 24
            Gender: Male
            Posts: 59
            MINDEPOSIT is set in script section "Settings"

            Thanks, I see that I messed up in pbWithdrawBank with kernel.MessageChooseNumber
            and had to change $game_variables[014] to 016 for the correct one to be used.

            All works now.

            Now i must ask, do you have any info on drawing a new moneybox? like pbDisplayCoinsWindow?
            Reply With Quote
              #6    
            Old April 8th, 2013 (3:04 PM).
            Lord Varion's Avatar
            Lord Varion Lord Varion is offline
            Guess who's back?
               
              Join Date: Feb 2009
              Age: 23
              Gender: Other
              Nature: Naughty
              Posts: 2,644
              I've made a bank system using simple events;
              If you want some help with it?


              EDit: never mind, I see you've done it.
              __________________
              gone.
              Reply With Quote
                #7    
              Old April 8th, 2013 (4:23 PM).
              Maruno's Avatar
              Maruno Maruno is offline
              Lead Dev of Pokémon Essentials
                 
                Join Date: Jan 2008
                Location: England
                Posts: 5,180
                Quote:
                Originally Posted by Black Eternity View Post
                Now i must ask, do you have any info on drawing a new moneybox? like pbDisplayCoinsWindow?
                I figured things out when I created the coins window. The big thing to watch out for is making sure your new window won't overlap with either the money or coins window (if you want to show either/both of them at the same time) - if you're only ever going to show your window on its own, that makes things easier. I'm going to assume the easier case.

                The script section PokemonMessages is what you want. Normally I wouldn't advise touching this, and even though the following instructions are fairly simple, I take no responsibility for any mucking-up that happens. In a nutshell, you're copying how the gold window works.

                First, find def pbDisplayGoldWindow, copy-paste it and turn it into what you want.

                Next, pick a letter or two to use to display your new window. For example, \G shows the money window, and \CN shows the coins window. Make sure it's not already being used by something else. Now find the longest line in that script section, which begins: while text[/(?:\\([WwFf]|[Ff][Ff]|... This line lists all the message commands available. A little over halfway into it is \\([Gg]|[Cc][Nn]|[Ww][Dd]|, and hopefully my colouring helps you see what's going on. Take your letter or two and put it straight after the coins part (including another vertical pipe to separate them). There's an example of a one-letter command and a two-letter command.

                Now an easier part. A little further down, find the line which says: elsif control=="g". Copy-paste the three lines of this part and rename all the things accordingly. This includes goldwindow - call it something else, remember what you called it, and read the next paragraph.

                Finally, there are two other lines to add in. Basically, find goldwindow=nil and goldwindow.dispose if goldwindow, and copy-paste them both and rename the things to what you chose in the previous paragraph.

                Done!



                My explanation could have been more eloquent. I'm tired.
                __________________
                Go to the Pokémon Essentials Wiki

                | Downloads | Tutorials | Fangames |
                | All Animations Project |

                Follow me on Twitter: @maruno42


                Reply With Quote
                  #8    
                Old April 8th, 2013 (5:52 PM).
                Black Eternity's Avatar
                Black Eternity Black Eternity is offline
                Lord of Eternity
                   
                  Join Date: Sep 2012
                  Age: 24
                  Gender: Male
                  Posts: 59
                  Thank you so much Maruno! I was able to get the bankwindow on the first try!
                  I greatly appreciate your help.
                  __________________

                  [Pokemon Essentials Scripts]
                  Banking System: Here
                  Berry Trading System: Here
                  Reply With Quote
                  Reply

                  Quick Reply

                  Join the conversation!

                  Create an account to post a reply in this thread, participate in other discussions, and more!

                  Create a PokéCommunity Account

                  Sponsored Links
                  Thread Tools

                  Posting Rules
                  You may not post new threads
                  You may not post replies
                  You may not post attachments
                  You may not edit your posts

                  BB code is On
                  Smilies are On
                  [IMG] code is On
                  HTML code is Off

                  Forum Jump


                  All times are GMT -8. The time now is 9:54 AM.