• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Trainer Card Flipping: N00b Problem

  • 189
    Posts
    15
    Years
    • Seen Jun 12, 2024
    Hey all,
    As you can probably guess from the topic title, I'm having a n00b problem with some coding. Now, I'm not uninitiated with coding, being a student of programming presently at university, but RGSS remains 99% unfamiliar to me. All I've worked with is Pascal and C.

    As such, I figured that with the need to eventually script some major stuff for my game, it'd be best to start small, so I followed the suggestions of many more experienced coders and began work on modifying the Trainer Card script.

    My aim was to implement a feature such that when one has the Trainer Card open, pressing the A button (i.e. the Z key) would show a separate screen for the badges, along with their titles (and maybe more, if I have room). Once there, one would simply press B (i.e. Esc or X) to return to the original screen.

    So I made a duplicate of the pbStartScene and pbDrawTrainerCardFront defs, naming them pbBadgeScene and pbDrawTrainerCardBack respectively, and started modifying it to show my new graphics instead. I also mucked around with the text a bit to be doubly sure it was drawing correctly.

    So with all that done, I went to try it out in game. Did it work? Nope.avi. The Trainer Card stayed as is, and I noticed that trying to quit that caused it to do so without the usual fade effect. In addition, hitting C (i.e. Enter, C, Space) after having hit A cause the fade to occur, but leave the Trainer Card graphics up until one quit the Pause Menu itself.

    Figuring I must have coded the button press thingy wrong, I simply took the calls and stuck them in directly after pbStartScene and pbTrainerCard in the PokemonTrainerCard class. Surely they would run then, if not at button press. Nope.avi.

    This time, after exiting the TrainerCard normally, my graphic was finally there. But, like the dodgy regular Card from before, it didn't actually do anything (not even return to the original card) and was effectively just plastered on top of the Pause Menu.

    I'm at a loss to understand what I'm doing wrong. I chucked in some Message Windows to track how far through my code it goes, but none of them show up. Can someone please educate me? I've included the relevant code below for reference. Blue indicated additions, while maroon indicates modifications.

    Spoiler:

    TL;DR Holy crap I type a lot.
    Cheers, Jim.
     
    I've tried everything in that thread. I've put code in a dozen different places, I've deleted the whole damn thing and started again... I don't know what else to do. Obviously I'm doing something wrong, otherwise something would have changed by now. But no, at every stage it just keeps doing the exact same thing. I'm just gonna give up here, and abandon the idea. Thanks anyway.
     
    When you are with problems in any script, put a 'p "test 1" ', 'p "test 2" ', 'p "test 3" '... between every line to know where you code are stopping.

    Use:

    Code:
     def pbStartScreen
        @scene.pbStartScene
        @scene.pbTrainerCard
        @scene.pbEndScene
      end

    In pbTrainerCard and pbBadgeCard put a button to cancel (break) and other to:
    Code:
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
    @scene.pbBadgeScene
    @scene.pbBadgeCard
    break

    In pbBadgeCard, instead of call pbBadgeScene and pbBadgeCard, calls pbStartScene and pbTrainerCard.
     
    So let me get this straight, in regards to that second part... Lets say the Trainer Card loop is Loop A, and the Badge Card loop is Loop B. They are both identical, save for the fact that Loop A closes the A procedures while starting the B loop, while Loop B closes the B procedures while starting the A loop.

    Thus rather than having a Superloop which initiates a Subloop (as I had above), it is two equal loops that self-terminate and alternate functioning until Input::B? Alright, I'll give it a shot and append my results later.

    EDIT: I tried that, and it didn't work. It just functions as if it were pbEndScene, sans the slow fade out from pbFadeOutAndHide. I put in some of those p things to see where my code got to, as follows:
    Code:
            pbDisposeSpriteHash(@sprites)
            @viewport.dispose
            p "test1"
            @scene.pbBadgeScene
            @scene.pbBadgeCard
            p "test2"
            break
    and it only shows test1. I figure something must be preventing it from reaching test2. Something in trying to execute this code causes it to successfully dispose the scene and display test1, but then cease before executing the subsequent calls. This is frustrating me more than the time my programming teacher gave us the trick question of making a "readstring" function in C.
     
    Last edited:
    I go a lot of time trying to put a Trainer Card as in Pokemon's games, but I do not know do like that works.

    It would be a good idea a tutorial of this.
     
    FL, you are a godsend. It had been driving me mad trying to understand why it wasn't working, and it all came down to that. Thank you for your help and your patience. Now, to figure out a non-linear algorithm that will plot my badges to fit the new graphic...
     
    I go a lot of time trying to put a Trainer Card as in Pokemon's games, but I do not know do like that works.

    It would be a good idea a tutorial of this.
    Trainer Card is a basic Essentials scene example, but is possible to make a even more basic Essential scene to better understand.

    To understand Essentials scenes, first try to understand RPG Maker XP scenes, there are several tutorial on web.
     
    Back
    Top