It's packaged with ZC. Just uncomment that line and you're good to go!
#31
Posted 25 January 2014 - 01:06 AM
#32
Posted 25 January 2014 - 01:08 AM
Okay, I feel rather stupid now. Thanks!
#33
Posted 25 January 2014 - 06:39 AM
#34
Posted 06 June 2014 - 02:54 PM
I would want to contribute a pair of functions that allow easier remapping of controls for interacting with scripts:
const int BUTTON_UP = 0; const int BUTTON_DOWN = 1; const int BUTTON_LEFT = 2; const int BUTTON_RIGHT = 3; const int BUTTON_B = 4; const int BUTTON_A = 5; const int BUTTON_L = 6; const int BUTTON_R = 7; const int BUTTON_MAP = 8; const int BUTTON_START = 9; const int BUTTON_EX1 = 10; const int BUTTON_EX2 = 11; const int BUTTON_EX3 = 12; const int BUTTON_EX4 = 13; //Returns TRUE if the player is holding down given button bool RemappableButtonInput( int button){ if (button == BUTTON_UP) return Link->InputUp; if (button == BUTTON_DOWN) return Link->InputDown; if (button == BUTTON_LEFT) return Link->InputLeft; if (button == BUTTON_RIGHT) return Link->InputRight; if (button == BUTTON_B) return Link->InputB; if (button == BUTTON_A) return Link->InputA; if (button == BUTTON_L) return Link->InputL; if (button == BUTTON_R) return Link->InputR; if (button == BUTTON_MAP) return Link->InputMap; if (button == BUTTON_START) return Link->InputStart; if (button == BUTTON_EX1) return Link->InputEx1; if (button == BUTTON_EX2) return Link->InputEx2; if (button == BUTTON_EX3) return Link->InputEx3; if (button == BUTTON_EX4) return Link->InputEx4; return false; } //Returns TRUE if the player has pressed the given button in the current frame. bool RemappableButtonPress( int button){ if (button == BUTTON_UP) return Link->PressUp; if (button == BUTTON_DOWN) return Link->PressDown; if (button == BUTTON_LEFT) return Link->PressLeft; if (button == BUTTON_RIGHT) return Link->PressRight; if (button == BUTTON_B) return Link->PressB; if (button == BUTTON_A) return Link->PressA; if (button == BUTTON_L) return Link->PressL; if (button == BUTTON_R) return Link->PressR; if (button == BUTTON_MAP) return Link->PressMap; if (button == BUTTON_START) return Link->PressStart; if (button == BUTTON_EX1) return Link->PressEx1; if (button == BUTTON_EX2) return Link->PressEx2; if (button == BUTTON_EX3) return Link->PressEx3; if (button == BUTTON_EX4) return Link->PressEx4; }
Constructive criticism as well as bug reports are welcome.
Edited by Alucard648, 06 June 2014 - 02:55 PM.
#35
Posted 07 June 2014 - 09:48 AM
I would want to contribute a pair of functions that allow easier remapping of controls for interacting with scripts:
const int BUTTON_UP = 0; const int BUTTON_DOWN = 1; const int BUTTON_LEFT = 2; const int BUTTON_RIGHT = 3; const int BUTTON_B = 4; const int BUTTON_A = 5; const int BUTTON_L = 6; const int BUTTON_R = 7; const int BUTTON_MAP = 8; const int BUTTON_START = 9; const int BUTTON_EX1 = 10; const int BUTTON_EX2 = 11; const int BUTTON_EX3 = 12; const int BUTTON_EX4 = 13; //Returns TRUE if the player is holding down given button bool RemappableButtonInput( int button){ if (button == BUTTON_UP) return Link->InputUp; if (button == BUTTON_DOWN) return Link->InputDown; if (button == BUTTON_LEFT) return Link->InputLeft; if (button == BUTTON_RIGHT) return Link->InputRight; if (button == BUTTON_B) return Link->InputB; if (button == BUTTON_A) return Link->InputA; if (button == BUTTON_L) return Link->InputL; if (button == BUTTON_R) return Link->InputR; if (button == BUTTON_MAP) return Link->InputMap; if (button == BUTTON_START) return Link->InputStart; if (button == BUTTON_EX1) return Link->InputEx1; if (button == BUTTON_EX2) return Link->InputEx2; if (button == BUTTON_EX3) return Link->InputEx3; if (button == BUTTON_EX4) return Link->InputEx4; return false; } //Returns TRUE if the player has pressed the given button in the current frame. bool RemappableButtonPress( int button){ if (button == BUTTON_UP) return Link->PressUp; if (button == BUTTON_DOWN) return Link->PressDown; if (button == BUTTON_LEFT) return Link->PressLeft; if (button == BUTTON_RIGHT) return Link->PressRight; if (button == BUTTON_B) return Link->PressB; if (button == BUTTON_A) return Link->PressA; if (button == BUTTON_L) return Link->PressL; if (button == BUTTON_R) return Link->PressR; if (button == BUTTON_MAP) return Link->PressMap; if (button == BUTTON_START) return Link->PressStart; if (button == BUTTON_EX1) return Link->PressEx1; if (button == BUTTON_EX2) return Link->PressEx2; if (button == BUTTON_EX3) return Link->PressEx3; if (button == BUTTON_EX4) return Link->PressEx4; }Constructive criticism as well as bug reports are welcome.
I wasn't aware that the buttons had a numeric equivalent that was so straightforward. That would be an ideal way to allow players to reconfigure buttons within a game, or to force re-map them during a sequence.
#36
Posted 07 June 2014 - 02:32 PM
The buttons don't have a numeric equivalent, normally - this script 'defines' them for you. If you could also make a pair of functions that press the buttons for you, that could be really helpful!
Example:
SetButtonPress(BUTTON_A, GetButtonPress(BUTTON_B));
#37
Posted 09 June 2014 - 07:40 AM
Right, so at least I didn't miss something completely obvious. That makes a good change.
I wholeheartedly agree, that something that creates a button press, would be very useful. (I believe I requested something like that, a good while back.)
You'd probably want something like pressButton(int button) to replicate the Link->PRESS, and inputButton(int button, bool pressed) to replicate the pressed state of Link->Input, and the unpressed state of Link->Input.
A clearing function unpressButton(int button) may also be good. That would essentially be this:
void unpressButton(int button) if (button == BUTTON_UP) return Link->InputUp = false; if (button == BUTTON_DOWN) return Link->InputDown = false; if (button == BUTTON_LEFT) return Link->InputLeft = false; if (button == BUTTON_RIGHT) return Link->InputRight = false; if (button == BUTTON_B) return Link->InputB = false; if (button == BUTTON_A) return Link->InputA = false; if (button == BUTTON_L) return Link->InputL = false; if (button == BUTTON_R) return Link->InputR = false; if (button == BUTTON_MAP) return Link->InputMap = false; if (button == BUTTON_START) return Link->InputStart = false; if (button == BUTTON_EX1) return Link->InputEx1 = false; if (button == BUTTON_EX2) return Link->InputEx2 = false; if (button == BUTTON_EX3) return Link->InputEx3 = false; if (button == BUTTON_EX4) return Link->InputEx4 = false; }
Edited by ZoriaRPG, 09 June 2014 - 07:42 AM.
#38
Posted 20 June 2014 - 02:55 PM
Another function. This time the one that is used mostly for debugging:
//Prints customized error message into allegro.log //Also prints any debug info you provided. //int message[] - String for error message. Max 512 characters. //int debuginfo[] - Array of integers for debug info to be printed alongside the error message. void ErrorLog (int message, int debuginfo){ int index[] = "Error: "; TraceNL(); TraceS(index); TraceS(message); TraceNL(); int text[] = "Debug information:"; TraceS(text); TraceNL(); for (int i=0; i < SizeOfArray(debuginfo); i++){ int debug = debuginfo[i]; Trace(debug); TraceNL(); } }
Also tagged with one or more of these keywords: Header
ghost
Zelda Classic →
Scripting Discussion →
Testers Wanted for Ghost 2.9.0Started by Timelord , 07 Oct 2021 ghost, autoghost, 2.9, 2.9.0 and 5 more... |
|
|
||
header
Zelda Classic →
Scripting Discussion →
ItemHoldUpMessage.zhStarted by Timelord , 02 Aug 2017 header, item, items, hold, up and 3 more... |
|
|
||
header
Zelda Classic →
Scripting Discussion →
Music.zhStarted by Timelord , 03 Jul 2017 header, music, enhanced, boss and 1 more... |
|
|
||
Zelda Classic →
Scripting Discussion →
Check ZC Version (2.50.0, 2.50.1, 2.50.2) with this HeaderStarted by Timelord , 30 Nov 2015 header, version |
|
|
||
experimental
Zelda Classic →
Scripting Discussion →
Five Screens AwayStarted by Timelord , 21 Aug 2015 experimental, header, module and 1 more... |
|
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users