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.

Reply
 
Thread Tools
  #1    
Old January 10th, 2012 (7:47 PM). Edited January 12th, 2012 by Ho-oh 112.
Ho-oh 112's Avatar
Ho-oh 112 Ho-oh 112 is offline
Advance Scripter
     
    Join Date: Feb 2011
    Age: 21
    Gender: Male
    Nature: Hasty
    Posts: 311
    Right, so you want to learn some Poke-Essentials scripting? Well, you came to the right place (sorta if you want to learn basics Medium + Advance comming soon....)

    Contents


    1 Contents
    2 Basic Commands
    3 Basic Scripts
    4 Medium Commands


    BEFORE YOU THINK THIS IS COMPLETE IT'S NOT!

    Basic Commands
    The basics are just adding elements to your game... (the pb stuff)

    Kernel.pbMessage(_INTL("Message here")) - Displays a message Via Script.
    pbAddPokemon(PBSpecies::PokemonNameHere, Level) - Adds a pokemon and it's level
    pbReceiveItem(PBItems::ItemNameHere) - Receive Item
    pbItemBall(PBItems::ItemNameHere) - Receive Item (from a pokeball thing)
    pbGenerateEgg(PBSpecies::PokemonNameHere) - generates a pokemon egg (PARTY MUST HAVE LESS THAN 6 POKEMON TO RECEIVE)
    pbAddForeignPokemon(species,level,ownerName,nickname), Adds a Pokemon owned by someone else

    Basic Scripts:

    Basic scripts are consisted of stuff you find above + a few more commands, here is a basic script with comments on how it works

    def pbGenerateDebugParty # call method, (use pbGenerateDebugParty to activate)
    Kernel.pbMessage(_INTL("Giving you your debug party + a random masterball...."))
    pbReceiveItem(PBItems::MasterBall) # Adds a master ball
    pbAddPokemon(PBSpecies::Mew, PBExperience::MAXLEVEL) # adds a mew at max level
    pbAddPokemon(PBSpecies::Mewtwo, PBExperience::MAXLEVEL) # adds a mewtwo at max level
    pbAddPokemon(PBSpecies::Deoxys, PBExperience::MAXLEVEL) # adds a Deoxys at max level
    pbAddPokemon(PBSpecies::Jirachi, PBExperience::MAXLEVEL) # adds a Jirachi at max level
    pbAddPokemon(PBSpecies::Arceus, PBExperience::MAXLEVEL) # adds an Arceus at max level
    pbAddPokemon(PBSpecies::Magikarp, 1) # adds a Magikarp at level 1
    # NOTE: THESE MAY NEED TO BE CAPITALIZED DEPENDING ON INTERNAL NAME OF POKEMON!!
    end # Ends script so it doesn't crash game.

    Calling this will give you those 6 pokemon at those levels.


    Medium Commands:

    Pokemon Creations:
    p=PokeBattle_Pokemon.new(specieshere,levelhere,$TrainerIfOwnedByTrainer)
    p.makeShiny - makes pokemon shiny
    p.makeShadow - makes pokemon shadow
    p.moves[0-3] - moves array (0 being first, 1 being second, ect)
    p.form - current form
    p.gender - current gender
    p.isShiny? - returns true if the pokemon is shiny else false
    p.isShadow? - returns true if the pokemon is shadow else false
    p.abilityflag = 0-2 - (2 being hidden ability)
    p.setNature(natureIDhere)
    I can go on about the different stats, but you get the idea....

    pbAddToParty(p) when you are done to add to party

    downloading strings - string=pbDownloadToString(URLHERE)
    downloads a string from the url to string

    $Trainer - trainer fixnum
    $Trainer.party - party pokemon array
    $Trainer.party[0-5] - 0 being first, 1 being second, ect
    $Trainer.party.length - gets the players party length
    $Trainer.name = "Bob" - sets the player's name to Bob


    Converting variables to files

    File.open('text.txt', 'wb'){|f| - we use wb to write and rb to read....
    f.write("Hello, this is a sample text file!!!") - writes what it says inside the ""
    } - closes the file

    Converting files to strings

    File.open('text.txt', 'rb'){|f|
    string=f.read - reads the WHOLE text.txt
    }

    p string - prints out what it says in text.txt

    converting strings to variables and then back to a string....
    string = "4"
    string = string.to_i - .to_i is to interger
    string += 50
    string.to_s - .to_s is to string

    array=[string, string.to_i -= 10] - writes an array
    array.pack("M") - does a compile over the strings...

    then we can add it to a file
    File.open('text.txt', 'wb'){|f|
    f.write(array)
    }

    just so we can load it
    File.open('text.txt', 'wb'){|f|
    array=f.read
    }
    array.unpack("M") - uncompiles array

    p array - prints out the array....

    Medium Scripts comming soon....
    __________________
    Scripting Level: Advance

    RMXP Poke-Essentials MySQL Trading System Link:
    http://www.pokecommunity.com/showthread.php?p=7077162#post7077162

    RMXP Poke-Essentials Mystery Gift Link:
    http://www.pokecommunity.com/showthread.php?t=270687

    RMXP Poke-Essentials Award System Link:
    http://www.pokecommunity.com/showthread.php?p=7111566
    Reply With Quote

    Relevant Advertising!

      #2    
    Old January 20th, 2012 (12:47 PM).
    Pia Carrot's Avatar
    Pia Carrot Pia Carrot is offline
    There is no brighter jewel...
    • Silver Tier
     
    Join Date: Aug 2010
    Age: 21
    Gender: Male
    Nature: Adamant
    Posts: 720
    Alright, this is really cool. I'm having trouble making a script to obtain a shiny shroomish from a NPC. I've tried using a switch but it doesn't work. So how would I make a script that is triggered by a switch to give the player a shiny shroomish, yet has a preset nickname?

    Thanks,
    Pia Carrot
    __________________
    This signature has been disabled.
    Signature exceeds height limit. Reupload the images to a different site.
    Please review and fix the issues by reading the signature rules.

    You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

    Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
    Reply With Quote
      #3    
    Old January 30th, 2012 (8:09 PM).
    Ho-oh 112's Avatar
    Ho-oh 112 Ho-oh 112 is offline
    Advance Scripter
       
      Join Date: Feb 2011
      Age: 21
      Gender: Male
      Nature: Hasty
      Posts: 311
      Quote:
      Originally Posted by Evil Arms View Post
      Alright, this is really cool. I'm having trouble making a script to obtain a shiny shroomish from a NPC. I've tried using a switch but it doesn't work. So how would I make a script that is triggered by a switch to give the player a shiny shroomish, yet has a preset nickname?

      Thanks,
      Pia Carrot

      Common event: Auto run by Switch [switch here]

      Script: p = PokeBattle_Pokemon.new(PBSpecies:HROOMISH, level here)
      p.name = "Nickname inside the parentheses"
      p.makeShiny
      pbAddToParty(p)


      switch here == off
      __________________
      Scripting Level: Advance

      RMXP Poke-Essentials MySQL Trading System Link:
      http://www.pokecommunity.com/showthread.php?p=7077162#post7077162

      RMXP Poke-Essentials Mystery Gift Link:
      http://www.pokecommunity.com/showthread.php?t=270687

      RMXP Poke-Essentials Award System Link:
      http://www.pokecommunity.com/showthread.php?p=7111566
      Reply With Quote
      Reply
      Quick Reply

      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 2:39 PM.