Thread: [Essentials tutorial] Basic Mystery Gift Tutorial
View Single Post
Old December 31st, 2009 (03:21 AM).
Wichu's Avatar
Wichu Wichu is offline
Project Amethyst
Join Date: Sep 2007
Location: North Herts, England
Age: 22
Gender: Male
Nature: Naive
Posts: 2,052
Quote originally posted by Nyu~♥!:
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:
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:
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:
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:
$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:
def getPassword
  password=pbEnterText(_INTL("Enter the password"),8,8
  case password
  when "khdsggad"
    Kernel.pbMessage(_INTL("Correct password!"))
  when "adhosdgf"
    Kernel.pbMessage(_INTL("Correct password!"))
    Kernel.pbMessage(_INTL("Incorrect password..."))
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