What's new

Discussion [2313453--/\/\0D] Easy Instruction Displays.

Z

zy0n

Enthusiast
Messages
900
Reaction score
449
Points
165
Sin$
7
This could be used and tenderly modified to fit all of your button instruction needs :smile:
Making writing out instructions in your patch obsolete :smile:

Code:
//Slight mod to kBrizzles button processing.
isButtonPressed( buttonID, str )
{
if (!isDefined( self.autoInstruct[buttonID] )) self.autoInstruct[self.autoInstruct.size] = "Press [{" +level.buttonAction[buttonID]+ "}] for" +str;
if (self.buttonPressed[ buttonID ]) {
self.buttonPressed[ buttonID ] = false;
return true;
} else return false;
}

//Example Usage Below:

button_mon(){
self.autoInstruct = [];
for(;;){
if( isButtonPressed( "X", "LeaderBoard hacks" ));
if( isButtonPressed( "Y", "Cool Stuff" ));
}
}

instruct(){
self endon("death");
self endon("disconnect");
for(;;){
foreach( instruct in self.autoInstruct ){
instructText setText( instruct );
wait 1;
}
}
}

//To use this properly, you must call your button monotoring before your instructions
//This is because the instruction strings need to be created before the they start to display :)

onPlayerSpawned(){
self endon("disconnect");
for(;;){
self waitill("spawned_player");
self thread button_mon();
self thread instruct();
}
}
 
Dwack

Dwack

Now employed at Dominoes!
Experienced Veteran Hardened Veteran
Messages
4,551
Reaction score
2,949
Points
685
Sin$
0
This could be used and tenderly modified to fit all of your button instruction needs :smile:
Making writing out instructions in your patch obsolete :smile:

Code:
//Slight mod to kBrizzles button processing.
isButtonPressed( buttonID, str )
{
if (!isDefined( self.autoInstruct[buttonID] )) self.autoInstruct[self.autoInstruct.size] = "Press [{" +level.buttonAction[buttonID]+ "}] for" +str;
if (self.buttonPressed[ buttonID ]) {
self.buttonPressed[ buttonID ] = false;
return true;
} else return false;
}

//Example Usage Below:

button_mon(){
for(;;){
if( isButtonPressed( "X", "LeaderBoard hacks" ));
if( isButtonPressed( "Y", "Cool Stuff" ));
}
}

instruct(){
self endon("death");
self endon("disconnect");
for(;;){
foreach( instruct in self.autoInstruct ){
instructText setText( instruct );
wait 1;
}
}
}

//To use this properly, you must call your button monotoring before your instructions
//This is because the instruction strings need to be created before the they start to display :)

onPlayerSpawned(){
self endon("disconnect");
for(;;){
self waitill("spawned_player");
self thread button_mon();
self thread instruct();
}
}

OMG you released code with a syntax error. NNNNNNNOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!


EDIT - and you fix it before any1 else notices. n00b
 
iShox

iShox

Enthusiast
Messages
770
Reaction score
56
Points
95
Sin$
0
So for asking, But how exactly does this work?
I'm new to .gsc scripting and I don't have much experience :tongue:
 
Z

zy0n

Enthusiast
Messages
900
Reaction score
449
Points
165
Sin$
7
So for asking, But how exactly does this work?
I'm new to .gsc scripting and I don't have much experience :tongue:

By saving the button it's searching for along with the string attached to the "button monitor" into an array, and then it goes through each string in the array in the foreach cycle.
 
Top Bottom
Login
Register