The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.


Advertise here

Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old October 19th, 2013, 10:50 AM
BadSamaritan's Avatar
BadSamaritan
Its time for overtime
 
Join Date: May 2009

Advertise here
[EDIT: sorry for not putting "question" in the title, I always forget]

Hi guys, I've been stuck on a seemingly simple coding issue for a few hours. I just need the down and up buttons to scroll through the menu at the bottom right.



Code:
  def pbNextIndex(curindex)
    if Input.trigger?(Input::LEFT) && (curindex&1)==1
      return curindex-1
    elsif Input.trigger?(Input::RIGHT) &&  (curindex&1)==0
      return curindex+1
    elsif Input.trigger?(Input::UP) &&  (curindex&2)==2
      return curindex-2
    elsif Input.trigger?(Input::DOWN) &&  (curindex&2)==0
      return curindex+2
    end
    return curindex
  end
I'm not very code savvy, so I tried to make sense of it and tried various number/button combos, but nothing came to fruition. I'm sure it's because the original menu does not scroll all the way through, but alas I can't figure it out.

Any help would be awesome, because the system works 100% otherwise.
Reply With Quote
  #2    
Old October 19th, 2013, 12:49 PM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Now that I look at it, it's a bit odd how the battle commands work. Rather than using the perfectly valid built-in controls, it instead made the new def pbNextIndex to do the exact same thing.

Actually, it's probably a remnant from an older way it used to work, before it used Window_CommandPokemon. I'm not sure how it all makes sense, as it appears that both ways are working at once.

Anyway, try this:
Code:
def pbNextIndex(curindex)
  if Input.trigger?(Input::UP)
    return (curindex+3)%4
  elsif Input.trigger?(Input::DOWN)
    return (curindex+1)%4
  end
  return curindex
end
The only downside to this is that this also applies to the fight menu. If you wanted that to be a straight list too, then problem solved, but if you wanted it to be 2x2, you'd have to do something extra to keep it the way it is.
__________________

Last edited by Maruno; October 20th, 2013 at 03:44 PM.
Reply With Quote
  #3    
Old October 20th, 2013, 03:35 PM
BadSamaritan's Avatar
BadSamaritan
Its time for overtime
 
Join Date: May 2009
Ah that makes a lot of sense. I was wondering why, when I would have completely removed or changed a button input, that somehow the game was still interpreting me pressing them somehow haha.

And yes, I've created a "pbNextIndexnew" already, to avoid confliction.(though making the attack menu vertical isn't a bad idea for my purposes)

Anyways, the code works. It's worth noting for anyone else who wants to use this to make sure to add the "def" at the start, and also the UP and DOWN directions are flipped.

Thanks again for the help
Reply With Quote
  #4    
Old October 20th, 2013, 03:46 PM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Are you sure the up and down parts are the wrong way round? Looks to me like they should be fine.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 12:42 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.