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 April 2nd, 2012 (6:53 AM).
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
    Intro: Just another script I made....

    Version: 1.0

    Features:
    Saves the award data (see the tutorial for it to work)
    Allows array to string conversion
    Allows String to array conversion (in progress)
    Allows online award downloads (in progress)
    Allows writing a string version of an award to a file (doesn't overwrite older awards you converted it just adds)
    Allows for simple and semi-flexible award/completion types

    Notice: THE DOWNLOAD AWARDS WON'T WORK YET I NEED TO FINISH THE STRING TO ARRAY AND TEST OUT THE DOWNLOAD...

    Code:
    =begin
    functions:
    pbSetAward(award id) - Sets an award and gives you the prize
    pbResetAwards - Resets the rewards to default...
    pbCheckForAwards - ONLINE, downloads new awards and saves them
    pbCompileAward - Compiles an Award from $PokemonGlobal.Awards
    pbDisplayAwards - Displays a selected award from $PokemonGlobal.Awards(used wuth pbGetAwards)
    pbGetAwards - Shows a list of all Awards in $PokemonGlobal.Awards
    pbAwardCheck - Checks to see if an award is completed with the values if true it goes to pbSetAward
    =end
    
    =begin
    Awards Example: $PokemonGlobal.push(["Award Name","Award Discription","Award Type", "Award Value", unlocked(leave as false), Requirements To Check,Requirements Value,Compare])
    Award Name: Name of Award
    Award Discription: Discription of the award
    Award Type: Type of Award (Switch,Variable/Var,Pokemon,Egg,Item,Money)
    Switches: ["Switch",switchnum], Variables: ["Variable or Var",varnum], Pokemon: "Pokemon", Egg: "Egg", Item: "Item", Money: "Money"
    Award Value: Value of award: Switch true/false, Var/Variable anything, Pokemon [Pokemon,level], Egg: Species, Item: Item name, Money: Amount
    Award Unlocked: LEAVE AT FALSE IT WILL GO TRUE WHEN COMPLETED
    Award Requirements: Requirements to complete: Switch: Switch, Variable: Var/Variable,
    Pokedex Seen Entry: dexSeen, Pokedex Owned Entry: dexOwned, badges: badge
    Award Requirement Value: Switch: true/false Var/Variable: anything, Pokedex Seen: number(looks for greater than-equal),
    Pokedex Owned: number (searches for greater than-equal), badge: number looks to see if that specific badge is true
    Award Compare: Variables only this is used with: greater, less, equal, not each doing what should do (greater searchs with > ect.)
    NOTE: THESE DISCRIPTIONS ARE IN ORDER FOR THE AWARDS TO BE INPUTED WITH.
    =end
    
    def pbStartupAwards
    viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
      viewport.z=99999
      sprites={}
      commands=CommandList.new
      commands.add("check",_INTL("Check for new awards"))
      commands.add("list",_INTL("Award List"))
      commands.add("search",_INTL("Search for new Awards (Online)"))
      commands.add("compile",_INTL("Compile existing Award DEBUG ONLY")) if $DEBUG
      sprites["cmdwindow"]=Window_CommandPokemonEx.new(commands.list)
      cmdwindow=sprites["cmdwindow"]
      cmdwindow.viewport=viewport
      cmdwindow.resizeToFit(cmdwindow.commands)
      cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height
      cmdwindow.x=0
      cmdwindow.y=0
      cmdwindow.visible=true
      pbFadeInAndShow(sprites)
      ret=-1
          loop do
        loop do
          cmdwindow.update
          Graphics.update
          Input.update
          if Input.trigger?(Input::B)
            ret=-1
            break
            return ret
          end
          if Input.trigger?(Input::C)
            ret=cmdwindow.index
            break
          end
        end
        break if ret==-1
        cmd=commands.getCommand(ret)
        if cmd == "check"
          pbAwardCheck
        elsif cmd == "list"
          pbDisplayAwards
        elsif cmd == "search"
          pbCheckForAwards
        elsif cmd == "compile"
          pbCompileAward
        end
      end
      return if ret < 1
    end
    
    def pbSetAward(id)
      award=$PokemonGlobal.Awards[id]
      return if award[4] == true # if you got it already
      Kernel.pbMessage(_INTL("You have completed {1}!",award[0]))
      if award[2] == "Switch"
        Kernel.pbMessage(_INTL("You have received a mystery award! Search to find what has been unlocked!"))
        $game_switches[award[3][0]] = award[3][1]
        $game_map.refresh
      end
      if award[2] == "Pokemon"
        pbAddPokemon(award[3][0],award[3][1])
      end
      if award[2] == "Money"
        Kernel.pbMessage(_INTL("You got ${1}",award[3]))
        $Trainer.money+=award[3]
      end
      if award[2] == "Item"
        pbReceiveItem(award[3][0],award[3][1])
      end
      if award[2] == "Egg"
        if $Trainer.party.length == 6
          Kernel.pbMessage(_INTL("Your party is full!"))
          return
        end
        pbGenerateEgg(award[3])
      end
      if award[2] == "Var" or award[2] == "Variable"
        Kernel.pbMessage(_INTL("You have received a mystery award! Search to find what has been unlocked!"))
        $game_variables[award[3][0]] == award[3][1]
        $game_map.refresh
      end
      $PokemonGlobal.Awards[id][4]=true
    end
    
    def pbCheckForAwards
      new=false
      url="http://www.linkhere.com/DLC/awards.txt"
      string=pbDownloadToString(url)
      x=false
      x=true if string == ""
      awards=string.split("/,,/")
      for i in $PokemonGlobal.Awards
        break if x == true
        for j in awards
          break if x == true
          if i != j
            # Displays A new award has been found, the name, and discription
            Kernel.pbMessage(_INTL("A new award has been found! {1}: {2}",i[0],i[1]))
            $PokemonGlobal.Awards.push(i)
            new=true
          end
        end
      end
      if new == false
        Kernel.pbMessage(_INTL("There are no new awards...."))
      end
    end
    
    def pbStringIt(ary,ary2=nil)
      ret = ""
      sub = ""
      for i in ary
        if i.is_a?(Array)
          for j in i
            sub="#{sub},,#{j}" if sub != ""
            sub="#{j}" if sub == ""
          end
          ret="#{ret},,,#{sub}"
          sub=""
        else
          ret="#{ret},,,#{i}" if ret != ""
          ret="#{i}" if ret == ""
        end
      end
      return ret if ary2 == nil
      ret="#{ret}/,,/"
      for i in ary2
        if i.is_a?(Array)
          for j in i
            sub="#{sub},,#{j}" if sub != ""
            sub="#{j}" if sub == ""
          end
          ret="#{ret},,,#{sub}"
          sub=""
        else
          ret="#{ret},,,#{i}" if ret != "#{ary}/,,/"
          ret="#{ret}#{i}" if ret == "#{ary}/,,/"
        end
      end
      return ret
    end
    
    def pbArrayIt(string)
      return string.split(",,,")
    end
    
    def pbCompileAward
      cmp=pbGetAwards
      compile=pbStringIt($PokemonGlobal.Awards[cmp])
      if FileTest.exist?('CompiledAwards.txt')
        File.open('CompiledAwards.txt'){|f|
        codes=f.read
        compile=pbStringIt(codes,compile) if codes != ""
        }
      end
      File.open('CompiledAwards.txt','wb'){|f|
      f.write(compile)
      }
      print "Your code has been saved in 'CompiledAwards.txt'"
    end
    
    def pbDisplayAwards
      # Note: You must add your own Awards to pokemon global!
      slct=pbGetAwards
      return if slct == -1
      award=$PokemonGlobal.Awards[slct]
      if award[4] == true
        got = "Unlocked"
      else
        got = "Locked"
      end
      # Displays differently because money has a different type of award type...
      if award[2] == "Money"
        Kernel.pbMessage(_INTL("{1}: {2}, Award: {3}, {4}",award[0],award[1],award[3],got)) 
      elsif award[2] == "Pokemon"
        Kernel.pbMessage(_INTL("{1}: {2}, Award: {3}, {4}",award[0],award[1],PBSpecies.getName(award[3][0]),got))
      elsif award[2] == "Switch" or award[2] == "Var" or award[2] == "Variable"
        Kernel.pbMessage(_INTL("{1}: {2}, Award: ???, {3}",award[0],award[1],got))
      else
        Kernel.pbMessage(_INTL("{1}: {2}, Award: {3}, {4}",award[0],award[1],award[3][1],got))
      end
    end
      
    def pbGetAwards
      default=1
      cmdwin=pbListWindow([],200)
      commands=[]
      for i in 1..$PokemonGlobal.Awards.length
        commands.push(_ISPRINTF("{1:s}",$PokemonGlobal.Awards[i-1][0]))
      end
      ret=pbCommands2(cmdwin,commands,-1,default-1,true) 
      cmdwin.dispose
      return ret
    end
    
    def pbAwardCheck
      for j in 0..$PokemonGlobal.Awards.length-1
        i=$PokemonGlobal.Awards[j]
        return if i == nil
        if i[5][0] == "Switch"
          if $game_switches[i[5][1]] == i[6]
            pbSetAward(j)
          end
        end
        if i[5][0] == "Var" or i[5][0] == "Variable"
          i[7] = "equal" if i[7]==nil 
          if i[7] == "equal"
            if $game_variables[i[5][1]] == i[6]
              pbSetAward(j)
            end
          end
          if i[7] == "greater"
            if $game_variables[i[5][1]] > i[6]
              pbSetAward(j)
            end
          end
          if i[7] == "less"
            if $game_variables[i[5][1]] < i[6]
              pbSetAward(j)
            end
          end
          if i[8] == "not"
            if $game_variables[i[5][1]] != i[6]
              pbSetAward(j)
            end
          end
        end
        if i[5] == "badge"
          if $Trainer.badges[i[6]] == true
            pbSetAward(j)
          end
        end
        if i[5] == "dexSeen"
          if $Trainer.pokedexSeen >= i[6]
            pbSetAward(j)
          end
        end
        if i[5] == "dexOwned"
          if $Trainer.pokedexOwned >= i[6]
            pbSetAward(j)
          end
        end
      end
    end
    Tutorial for getting the Pokemon Global Awards:

    1. Open pokemon map and look for this:

    add the highlighted line

    2. go here in pokemon map:

    again add the highlighted at the least add the @Awards=[]

    3. to safely insert new awards use the .push(award array here) way (last highlighted line on image2) this way you can't overwrite another award...

    4. have fun with it IT WAS TESTED!!!
    __________________
    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 April 6th, 2012 (2:31 PM).
    UnderMybrella's Avatar
    UnderMybrella UnderMybrella is offline
    Some Programmer
       
      Join Date: Jan 2011
      Location: Australia
      Gender: Other
      Nature: Calm
      Posts: 280
      Wow. Seems like a nice script. You are a very good scripter Ho-oh! Trying this out now!
      Reply With Quote
        #3    
      Old April 8th, 2012 (4:47 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 Anglican View Post
        Wow. Seems like a nice script. You are a very good scripter Ho-oh! Trying this out now!

        Thanks but this is incomplete as of online downloads of awards, I'll get to this a little later because I got to "fix" my trade script
        __________________
        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
          #4    
        Old April 9th, 2012 (1:25 AM).
        Nickalooose Nickalooose is offline
        --------------------
           
          Join Date: Mar 2008
          Gender: Female
          Posts: 1,309
          So what can this do then?

          if I put:

          @Awards.push...

          These will be the only awards available to the player, until you are able to get awards loaded from a web page thing to work, correct?

          Because I don't mind the "having internet" part, not implemented... I've got my own Awards, within my game, just yet to actually put them in... This could help alot! But If this already works, I would use this... If it's more for downloading the awards, I probably won't use it in that case, but good luck with that. X
          Reply With Quote
            #5    
          Old April 9th, 2012 (2:00 AM).
          SytheXP's Avatar
          SytheXP SytheXP is offline
          Net Labs/UG Founder
             
            Join Date: May 2007
            Location: Zombieville South Carolina
            Age: 26
            Gender: Male
            Nature: Calm
            Posts: 387
            I actually like the idea of this script a lot. Is there a way to view awards or add images for the awards? Kind of like Achievements from xbox360 games or trophies for the ps3
            __________________
            My Threads:
            Phantom Dusk Plot and Story: http://www.pokecommunity.com/showthread.php?p=4678023#post4678023


            My Sprite Thread:http://www.pokecommunity.com/showthread.php?t=179083

            Phantom Dusk is back in production with loads of modifications. Will be updating soon! -2012

            I Support:
            Reply With Quote
              #6    
            Old April 10th, 2012 (7:54 AM).
            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 SytheXP View Post
              I actually like the idea of this script a lot. Is there a way to view awards or add images for the awards? Kind of like Achievements from xbox360 games or trophies for the ps3
              Yeah this is a demo release of it I'll add picture support Also You can view awards use the Award Startup function it shows a list of commands you can use...
              __________________
              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
                #7    
              Old May 12th, 2012 (3:15 AM).
              Elyssia's Avatar
              Elyssia Elyssia is offline
                 
                Join Date: Nov 2010
                Location: The Netherlands
                Age: 26
                Gender: Female
                Nature: Gentle
                Posts: 43
                Isn't it the best to post the Second screenshot's code in the post?
                Like now, it seems incomplete to me... :/
                But this does looks nice, reminds me about Valve Steam's Achievement system
                Reply With Quote
                  #8    
                Old July 29th, 2012 (3:50 PM).
                mewlover22's Avatar
                mewlover22 mewlover22 is offline
                Pokemon Creator
                   
                  Join Date: Oct 2008
                  Location: South Carolina
                  Gender: Male
                  Nature: Quiet
                  Posts: 320
                  this looks like a good idea i take i have to copy and past it to use for now also how do you look at them and can i add my own?
                  __________________
                  Reply With Quote
                    #9    
                  Old July 29th, 2012 (5:46 PM).
                  Cilerba Cilerba is offline
                  the hearts of lonely people
                  • Silver Tier
                   
                  Join Date: Feb 2010
                  Location: Massachusetts
                  Age: 21
                  Gender: Male
                  Nature: Quiet
                  Posts: 1,171
                  This thread's a little over two months old so I'll have to lock this. Please remember to keep the rules in mind when posting in these forums.
                  __________________
                  Reply With Quote
                    #10    
                  Old January 3rd, 2014 (6:40 AM).
                  dydd90's Avatar
                  dydd90 dydd90 is offline
                     
                    Join Date: Dec 2013
                    Location: Italy
                    Gender: Male
                    Posts: 243
                    You are great Ho-oh this is my favourite script!!!
                    But i have a problem...someone can tell me how can i use it? sorry but i am not good with the script...thank you friends
                    __________________


                    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:23 PM.