Jump to content

Photo

The Idle of March


  • Please log in to reply
4 replies to this topic

#1 symbiote01

symbiote01

    Doyen(ne)

  • Members
  • Real Name:Doug
  • Location:WA

Posted 19 March 2017 - 04:18 PM

Okay, so I know how to check to see if a button has been pressed in a given frame (if(Link->InputA==0), if(Link->InputB==0), etc).  Is there a simple function to check if ANY button has been pressed?  My plan is that for every frame Link doesn't take any action, a tally goes up by one.  After perhaps 15 seconds of being idle, something happens (like a message plays).  If at any time a button is pressed, the tally resets.



#2 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 19 March 2017 - 06:21 PM

Link->Input will return true while the corresponding button is pressed and held down. Link->Press will return true if the corresponding button was press that frame.

 

To check if Link is idle you can either A) check that all inputs (not Press) are false. Or B) check Link->Action for LA_NONE. B is less reliable as it only check against actions Link maybe performing. Pressing Ex1 for example does not account for an action.

 

Their is no function currently in std, stdExtra or zscript that will check all inputs for you but it's simple to create one yourself.



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 March 2017 - 07:54 PM

Aye. For whatever reason , Link's inputs are not an array in 2.50.x, thus to check then all, you must call each input in sequence as individual instructions.

Another fine example if something that I have fixed.

bool AnyPress(){
    return ( Link->PressUp || Link->PressLeft || Link->PressRight || Link->PressDown || Link->PressA || Link->PressB || Link->PressL || Link->PressR || Link->PressEx1 || Link->PressEx2 || Link->PressEx3 || Link->PressEx4 );
}

That sort of thing is required for 2.50.x

#4 symbiote01

symbiote01

    Doyen(ne)

  • Members
  • Real Name:Doug
  • Location:WA

Posted 21 March 2017 - 03:47 AM

Thank you cavthena for the quick response, and ZoriaRPG for hammering the issue into oblivion!



#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 23 March 2017 - 10:55 PM

Thank you cavthena for the quick response, and ZoriaRPG for hammering the issue into oblivion!


Hehe. No problem, mate.

What I did, was make an array for Input[], JoyPress[] (only joypad, not keyboard), Press[] and KeyPress[] (any key, on the keyboard, read only).

All seem useful and safe to me.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users