What's new

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

Z

zy0n

Enthusiast
Messages
900
Reaction score
449
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();
}
}
 
F

fuzi8n x

Enthusiast
Messages
138
Reaction score
12
Looks to be quite useful.
 
D

Dwack

Now employed at Dominoes!
Messages
4,550
Reaction score
2,947
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
 
Z

zy0n

Enthusiast
Messages
900
Reaction score
449
OMG you released code with a syntax error. NNNNNNNOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!


EDIT - and you fix it before any1 else notices. n00b
:rolleyes:
I think you'rez the n00bz :tongue:
 
M

OOGauge

Enthusiast
Messages
433
Reaction score
13
I can't seem to get it to work?
 
I

iShox

Enthusiast
Messages
772
Reaction score
56
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
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.
 
M

OOGauge

Enthusiast
Messages
433
Reaction score
13
When i add it to my patch it gives me a sytax error.
 
Top Bottom