Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old December 13th, 2009 (4:47 PM).
|Maximus|'s Avatar
|Maximus| |Maximus| is offline
I'm back~
     
    Join Date: Aug 2007
    Age: 21
    Nature: Adamant
    Posts: 842
    Okay, so I have actually decided to make my first tutorial. This tutorial is going to be how to create a Basic Mystery Gift Person Dude Thingy

    Okay, so I am going to break this up into steps.

    1) Checking for a File

    So first you want to create a Conditional Branch with this line of script.

    Code:
    @> Conditional Branch: Script: FileTest.exist?("Arceus.pkmn")
       @>
      : Else
       @>
      : Branch End
    @>
    Basically, it checks if you have "Arceus.pkmn" inside of your game folder. View the video inside of my signature for how to create custom files.

    2) Adding the Effect

    So, what happens if you do have the file? Easy, we can add the Arceus.

    Code:
    @> Conditional Branch: Script: FileTest.exist?("Arceus.pkmn")
       @> Text: You have the Mystery Gift.
       @> Conditional Branch: Script: Kernel.pbAddPokemon(PBSpecies::ARCEUS,80)
          @> Self Switch: A = ON
          @>
      : Else
       @>
      : Branch End
    @>
      : Else
       @>
      : Branch End
    @>
    3)What if you don't have it?

    Well, thats easy. Just add whatever you want under 'else'


    Code:
    @> Conditional Branch: Script: FileTest.exist?("Arceus.pkmn")
       @> Text: You have the Mystery Gift.
       @> Conditional Branch: Script: Kernel.pbAddPokemon(PBSpecies::ARCEUS,80)
          @> Self Switch: A = ON
          @>
      : Else
       @>
      : Branch End
    @>
      : Else
       @> Text: The Gift is not for everyone.
       @>
      : Branch End
    @>
    Well, that's my tutorial I hope you enjoyed it, and found it useful! Check out the video in the spoiler in my signature because that is where you will find out how to convert TXT files into .PKMN files.

    PHEW, that's a lot of typing!
    Reply With Quote

    Relevant Advertising!

      #2    
    Old December 15th, 2009 (12:30 PM).
    Klofkac's Avatar
    Klofkac Klofkac is offline
    He's back!
       
      Join Date: Jun 2009
      Location: Sharpedo Bluff
      Age: 21
      Gender: Male
      Posts: 337
      I always wondered how to check file existing. And now I know it!
      I have question: How I check, what's in that file written?
      __________________

      I AM BACK!
      Reply With Quote
        #3    
      Old December 15th, 2009 (2:15 PM).
      Poeman Poeman is offline
      Banned
         
        Join Date: Nov 2008
        Age: 22
        Gender: Male
        Posts: 760
        I have done something like this before except it read data from a website after downloading it, much better because that way you can set events on the website :D
        Maybe we could implement my method into Sparkling Yellow?
        Reply With Quote
          #4    
        Old December 28th, 2009 (6:08 PM).
        darkerarceus's Avatar
        darkerarceus darkerarceus is offline
        Advanced RM2K3-er
           
          Join Date: Apr 2008
          Location: Canberra,Australia
          Gender: Male
          Nature: Relaxed
          Posts: 344
          Well I have viewed the video in your siganture 2 weeks ago and the point is wouldn't it be easy to just make the file Arceus.pkmn and errrr... Cheat?
          __________________
          5 Years on Pokecommunity. Wow. It's not like I'm on like once a year
          Reply With Quote
            #5    
          Old December 28th, 2009 (6:09 PM).
          Poeman Poeman is offline
          Banned
             
            Join Date: Nov 2008
            Age: 22
            Gender: Male
            Posts: 760
            Thats why reading from a server is safer.
            Reply With Quote
              #6    
            Old December 28th, 2009 (8:34 PM).
            |Maximus|'s Avatar
            |Maximus| |Maximus| is offline
            I'm back~
               
              Join Date: Aug 2007
              Age: 21
              Nature: Adamant
              Posts: 842
              Quote:
              Originally Posted by darkerarceus View Post
              Well I have viewed the video in your siganture 2 weeks ago and the point is wouldn't it be easy to just make the file Arceus.pkmn and errrr... Cheat?
              Well, people could-- Well I suppose -- I got nothing. Yeah, I guess that's true. Maybe, people could create a file that nobody else would think of. Like in example instead of "Arceus.pkmn" put "Crayon.pkmn" I don't know I was looking at a box of crayons when I typed this
              Reply With Quote
                #7    
              Old December 28th, 2009 (10:11 PM).
              davidthefat davidthefat is offline
              I Love C++
                 
                Join Date: Dec 2009
                Age: 23
                Gender: Male
                Posts: 437
                Ok heres my Idea, Im assuming this is obtainable through the game. You can have a entry in the database for a boolean (true, false) check if true, if true, check ID (When the mystery gift is obtained, the server generates random numbers and stores it as the ID and the client gets the ID and writes it in the file) and compared both IDs, if the same, allow it to take effect, if not, disable mystery gift forever, but that wont allow multiple accounts or sharing accounts...
                Reply With Quote
                  #8    
                Old December 29th, 2009 (2:24 AM).
                Wichu's Avatar
                Wichu Wichu is offline
                Project Amethyst
                   
                  Join Date: Sep 2007
                  Location: North Herts, England
                  Age: 24
                  Gender: Male
                  Nature: Naive
                  Posts: 2,052
                  Naming it something random isn't a good idea; security through obscurity isn't really security at all. It would take a single person to decrypt the game data, check the filenames needed, and post them on a forum, to completely ruin the whole thing.

                  The best way to do it is to implement everything on the server. The game doesn't do any checking whatsoever; instead, it pulls data off a website and creates a Pokémon from that.

                  That way, you can add new gifts after the game has been published, and make sure players can't cheat (short of hacking the site where it's stored). You could even add the code to a fixed forum post (the first post in the thread), and have the game read from that.

                  I'm probably going to make a tutorial for my method, and more :P
                  __________________
                  Reply With Quote
                    #9    
                  Old December 29th, 2009 (5:50 AM).
                  Ty 101's Avatar
                  Ty 101 Ty 101 is offline
                     
                    Join Date: Jul 2008
                    Posts: 526
                    Quote:
                    Originally Posted by Wichu View Post
                    Naming it something random isn't a good idea; security through obscurity isn't really security at all. It would take a single person to decrypt the game data, check the filenames needed, and post them on a forum, to completely ruin the whole thing.

                    The best way to do it is to implement everything on the server. The game doesn't do any checking whatsoever; instead, it pulls data off a website and creates a Pokémon from that.

                    That way, you can add new gifts after the game has been published, and make sure players can't cheat (short of hacking the site where it's stored). You could even add the code to a fixed forum post (the first post in the thread), and have the game read from that.

                    I'm probably going to make a tutorial for my method, and more
                    Whether you remember or not, about a half year ago you greatly helped me write a mystery gift event that read text from my website.
                    I knew pretty much nothing about scripting then and you helped me along.

                    It is still the only real feature in my game but with all of these tutorials, I guess that I will have to make something new.
                    __________________
                    Pokemon Forest of Secrets Creator.
                    Currently in the Drawing Board
                    Reply With Quote
                      #10    
                    Old December 29th, 2009 (6:06 PM).
                    Nyu~♥!'s Avatar
                    Nyu~♥! Nyu~♥! is offline
                    Pokémon Opal Producer
                       
                      Join Date: Jun 2009
                      Location: Somewhere!
                      Age: 22
                      Gender: Female
                      Nature: Gentle
                      Posts: 485
                      Quote:
                      Originally Posted by Wichu View Post
                      Naming it something random isn't a good idea; security through obscurity isn't really security at all. It would take a single person to decrypt the game data, check the filenames needed, and post them on a forum, to completely ruin the whole thing.

                      The best way to do it is to implement everything on the server. The game doesn't do any checking whatsoever; instead, it pulls data off a website and creates a Pokémon from that.

                      That way, you can add new gifts after the game has been published, and make sure players can't cheat (short of hacking the site where it's stored). You could even add the code to a fixed forum post (the first post in the thread), and have the game read from that.

                      I'm probably going to make a tutorial for my method, and more
                      Yeah, that'd be better. Though, I was thinking a different way before seeing this:
                      The player gets a secret code from the games site, which they can then enter into a certain computer. (of course, this code would be something totally unpredictable, like fhyd80292 or watev, lol) By doing this the player can pick up a certain item from a little map I created called the Delivery Office.
                      They would then activate it, by using it in a certain area, or using the item in it's own specialty(like the flutes playing) to start an event.


                      ..but, I totally suck at scripting such items. :/ And I don't know anything about inputting text. |o
                      __________________
                      Pokémon Opal has become partner's with another game! We are now hideAki!

                      Reply With Quote
                        #11    
                      Old December 30th, 2009 (8:01 AM).
                      |Maximus|'s Avatar
                      |Maximus| |Maximus| is offline
                      I'm back~
                         
                        Join Date: Aug 2007
                        Age: 21
                        Nature: Adamant
                        Posts: 842
                        Quote:
                        Originally Posted by Nyu~♥! View Post
                        Yeah, that'd be better. Though, I was thinking a different way before seeing this:
                        The player gets a secret code from the games site, which they can then enter into a certain computer. (of course, this code would be something totally unpredictable, like fhyd80292 or watev, lol) By doing this the player can pick up a certain item from a little map I created called the Delivery Office.
                        They would then activate it, by using it in a certain area, or using the item in it's own specialty(like the flutes playing) to start an event.


                        ..but, I totally suck at scripting such items. :/ And I don't know anything about inputting text. |o
                        By inputting text you could probably modify the name input method a little bit. And store the value of the "name" into a variable. Kind of like how it is done with the Rival's name input. But instead of having "Rival's Name?" put something like "Gift Code?" or something I don't know.
                        Reply With Quote
                          #12    
                        Old December 31st, 2009 (2:34 AM).
                        darkerarceus's Avatar
                        darkerarceus darkerarceus is offline
                        Advanced RM2K3-er
                           
                          Join Date: Apr 2008
                          Location: Canberra,Australia
                          Gender: Male
                          Nature: Relaxed
                          Posts: 344
                          Still about your inputting ideas couldn't you TELL someone the code?
                          Server Based could be good but it would take a good amount of scripting to do.
                          __________________
                          5 Years on Pokecommunity. Wow. It's not like I'm on like once a year
                          Reply With Quote
                            #13    
                          Old December 31st, 2009 (3:21 AM).
                          Wichu's Avatar
                          Wichu Wichu is offline
                          Project Amethyst
                             
                            Join Date: Sep 2007
                            Location: North Herts, England
                            Age: 24
                            Gender: Male
                            Nature: Naive
                            Posts: 2,052
                            Quote:
                            Originally Posted by Nyu~♥! View Post
                            Yeah, that'd be better. Though, I was thinking a different way before seeing this:
                            The player gets a secret code from the games site, which they can then enter into a certain computer. (of course, this code would be something totally unpredictable, like fhyd80292 or watev, lol) By doing this the player can pick up a certain item from a little map I created called the Delivery Office.
                            They would then activate it, by using it in a certain area, or using the item in it's own specialty(like the flutes playing) to start an event.


                            ..but, I totally suck at scripting such items. :/ And I don't know anything about inputting text. |o
                            That way, you'd still have to store the codes in an event in-game (you have to use a conditional branch somewhere); it would be easy to find them and cheat.
                            Quote:
                            Originally Posted by darkerarceus View Post
                            Still about your inputting ideas couldn't you TELL someone the code?
                            Server Based could be good but it would take a good amount of scripting to do.
                            Come on, it's not that hard to search through the scripts. In the Essentials intro event, there's a pbTrainerName script call which opens the text entry screen. Searching for 'pbTrainerName' in the scripts, and then seeing what methods are called within it, gets you this script:
                            Code:
                            trname=pbEnterText("Your name?",0,7)
                            This is obviously the text entry method. It appears to return the entered text, which here is assigned to the trname variable. Now you need to know what the arguments mean. Searching for 'def pbEnterText' gets you this:
                            Code:
                            def pbEnterText(helptext,minlength,maxlength,initialText="")
                            So, the first argument is the help text (could be "Enter the password."), the second is the minimum length (for example, if the password is 8 letters long, it would be 8), the third is the maximum length (same as before), and the last is the starting text (this should probably be left blank).
                            RMXP's variables are stored in the $game_variables array. So to store the password in, say, variable 100, you'd use:
                            Code:
                            $game_variables[100]=pbEnterText(_INTL("Enter the password"),8,8)
                            Then, you could use a conditional branch to check the password. However, doing it through events is convoluted; a script for this would be better. For example:
                            Code:
                            def getPassword
                              password=pbEnterText(_INTL("Enter the password"),8,8
                              case password
                              when "khdsggad"
                                Kernel.pbMessage(_INTL("Correct password!"))
                                Kernel.pbReceiveItem(PBItems::MEMBERSPASS)
                              when "adhosdgf"
                                Kernel.pbMessage(_INTL("Correct password!"))
                                Kernel.pbReceiveItem(PBItems::OAKSLETTER)
                              else
                                Kernel.pbMessage(_INTL("Incorrect password..."))
                              end
                            end
                            Server-based isn't difficult with Essentials' features; for example, the pbDownloadToString method is perfect for this. Using regular expression matching, you can even post the code directly in a thread.
                            __________________
                            Reply With Quote
                              #14    
                            Old December 31st, 2009 (3:25 AM).
                            darkerarceus's Avatar
                            darkerarceus darkerarceus is offline
                            Advanced RM2K3-er
                               
                              Join Date: Apr 2008
                              Location: Canberra,Australia
                              Gender: Male
                              Nature: Relaxed
                              Posts: 344
                              I get your point but the problem is that you can easily tell someone else the password.
                              __________________
                              5 Years on Pokecommunity. Wow. It's not like I'm on like once a year
                              Reply With Quote
                                #15    
                              Old December 31st, 2009 (3:31 AM).
                              Wichu's Avatar
                              Wichu Wichu is offline
                              Project Amethyst
                                 
                                Join Date: Sep 2007
                                Location: North Herts, England
                                Age: 24
                                Gender: Male
                                Nature: Naive
                                Posts: 2,052
                                Isn't the point of Mystery Gift that it allows events to be made public?
                                A server-based system would be better anyway, as a password system can be easily abused...
                                __________________
                                Reply With Quote
                                  #16    
                                Old December 31st, 2009 (3:34 AM).
                                darkerarceus's Avatar
                                darkerarceus darkerarceus is offline
                                Advanced RM2K3-er
                                   
                                  Join Date: Apr 2008
                                  Location: Canberra,Australia
                                  Gender: Male
                                  Nature: Relaxed
                                  Posts: 344
                                  Yup besides I think you would need it as events can expire...
                                  __________________
                                  5 Years on Pokecommunity. Wow. It's not like I'm on like once a year
                                  Reply With Quote
                                    #17    
                                  Old December 31st, 2009 (1:56 PM). Edited December 31st, 2009 by Nyu~♥!.
                                  Nyu~♥!'s Avatar
                                  Nyu~♥! Nyu~♥! is offline
                                  Pokémon Opal Producer
                                     
                                    Join Date: Jun 2009
                                    Location: Somewhere!
                                    Age: 22
                                    Gender: Female
                                    Nature: Gentle
                                    Posts: 485
                                    Quote:
                                    Originally Posted by darkerarceus View Post
                                    I get your point but the problem is that you can easily tell someone else the password.
                                    Quote:
                                    Originally Posted by Wichu View Post
                                    Isn't the point of Mystery Gift that it allows events to be made public?
                                    A server-based system would be better anyway, as a password system can be easily abused...
                                    erm.. yea..
                                    but anyway, Wichu has a great point that totally kills my idea. D:
                                    So.. does anyone know anything about a server based system? :/

                                    Quote:
                                    Originally Posted by Wichu View Post
                                    That way, you'd still have to store the codes in an event in-game (you have to use a conditional branch somewhere); it would be easy to find them and cheat.

                                    Come on, it's not that hard to search through the scripts. In the Essentials intro event, there's a pbTrainerName script call which opens the text entry screen. Searching for 'pbTrainerName' in the scripts, and then seeing what methods are called within it, gets you this script:
                                    Code:
                                    trname=pbEnterText("Your name?",0,7)
                                    This is obviously the text entry method. It appears to return the entered text, which here is assigned to the trname variable. Now you need to know what the arguments mean. Searching for 'def pbEnterText' gets you this:
                                    Code:
                                    def pbEnterText(helptext,minlength,maxlength,initialText="")
                                    So, the first argument is the help text (could be "Enter the password."), the second is the minimum length (for example, if the password is 8 letters long, it would be 8), the third is the maximum length (same as before), and the last is the starting text (this should probably be left blank).
                                    RMXP's variables are stored in the $game_variables array. So to store the password in, say, variable 100, you'd use:
                                    Code:
                                    $game_variables[100]=pbEnterText(_INTL("Enter the password"),8,8)
                                    Then, you could use a conditional branch to check the password. However, doing it through events is convoluted; a script for this would be better. For example:
                                    Code:
                                    def getPassword
                                      password=pbEnterText(_INTL("Enter the password"),8,8
                                      case password
                                      when "khdsggad"
                                        Kernel.pbMessage(_INTL("Correct password!"))
                                        Kernel.pbReceiveItem(PBItems::MEMBERSPASS)
                                      when "adhosdgf"
                                        Kernel.pbMessage(_INTL("Correct password!"))
                                        Kernel.pbReceiveItem(PBItems::OAKSLETTER)
                                      else
                                        Kernel.pbMessage(_INTL("Incorrect password..."))
                                      end
                                    end
                                    Server-based isn't difficult with Essentials' features; for example, the pbDownloadToString method is perfect for this. Using regular expression matching, you can even post the code directly in a thread.
                                    great script ideas right there. I'll need to try it until i figure out the server method.
                                    __________________
                                    Pokémon Opal has become partner's with another game! We are now hideAki!

                                    Reply With Quote
                                      #18    
                                    Old December 31st, 2009 (10:29 PM).
                                    |Maximus|'s Avatar
                                    |Maximus| |Maximus| is offline
                                    I'm back~
                                       
                                      Join Date: Aug 2007
                                      Age: 21
                                      Nature: Adamant
                                      Posts: 842
                                      Um...hehe...didn't I say, basic mystery gift lol?
                                      Reply With Quote
                                        #19    
                                      Old January 1st, 2010 (5:33 PM).
                                      Nyu~♥!'s Avatar
                                      Nyu~♥! Nyu~♥! is offline
                                      Pokémon Opal Producer
                                         
                                        Join Date: Jun 2009
                                        Location: Somewhere!
                                        Age: 22
                                        Gender: Female
                                        Nature: Gentle
                                        Posts: 485
                                        basic is always to be improved on.. can't we share our ideas? :/
                                        __________________
                                        Pokémon Opal has become partner's with another game! We are now hideAki!

                                        Reply With Quote
                                          #20    
                                        Old January 30th, 2010 (11:31 AM).
                                        Gigatom~'s Avatar
                                        Gigatom~ Gigatom~ is offline
                                        Pokemon Ruthenium Creator ~
                                           
                                          Join Date: Jan 2010
                                          Age: 22
                                          Gender: Male
                                          Posts: 116
                                          Nice, I'm using it.
                                          Now i'm making a mystery gift with Giratina ;)
                                          Thank you for this.

                                          Gigatom~
                                          __________________


                                          Check out my deviantArt! :3
                                          Reply With Quote
                                            #21    
                                          Old January 30th, 2010 (2:11 PM).
                                          |Maximus|'s Avatar
                                          |Maximus| |Maximus| is offline
                                          I'm back~
                                             
                                            Join Date: Aug 2007
                                            Age: 21
                                            Nature: Adamant
                                            Posts: 842
                                            Quote:
                                            Originally Posted by Gigatom~ View Post
                                            Nice, I'm using it.
                                            Now i'm making a mystery gift with Giratina
                                            Thank you for this.

                                            Gigatom~
                                            Ooh. That's nice!

                                            No problem!
                                            Reply With Quote
                                              #22    
                                            Old January 6th, 2011 (2:31 AM).
                                            PokemonManiac1's Avatar
                                            PokemonManiac1 PokemonManiac1 is offline
                                               
                                              Join Date: Dec 2010
                                              Gender: Male
                                              Posts: 9
                                              Please have you got a mystery gift that goes online and stores data from the pokemon?

                                              Because if i release my pokemon game how it's going to has diferrent mystery gift without to update my game?
                                              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 8:06 PM.