Thread: [Essentials Tutorial] Basic Mystery Gift Tutorial
View Single Post
  #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: 21
    Gender: Female
    Nature: Gentle
    Posts: 485
    Send a message via Yahoo to Nyu~♥!
    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