What's new

Discussion [ Testing Needed ] Button Monitoring System

  • Thread starter Public Static Void
  • Start date
  • Views 1,734
P

oO Di2eamZz

Enthusiast
Messages
1,364
Reaction score
245
Code shouldnt have a syntax but I'm not 100% positive it will work correctly, if it does enjoy a great button monitoring system!
Code:
onButtonPressed( buttonPressed )
{
for( ;; ){
if( self useButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self adsButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self attackButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self fragButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self meleeButtonPressed() ){
self notify( "button", buttonPressed );
}
}
}
onButtonHeld( buttonHeld, time )
{
for( ;; ){
if( self useButtonPressed() ){
while( self useButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self adsButtonPressed() ){
while( self adsButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self attackButtonPressed() ){
while( self attackButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self fragButtonPressed() ){
while( self fragButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self meleeButtonPressed() ){
while( self meleeButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
}
}


How to use:

Code:
if( self onButtonPressed( "reload" ) )
{

}
else if( self onButtonHeld( "reload", 1.5 ) )
{

}
 
AoKMiKeY

-Algorithm-

I am not a man.
Seasoned Veteran Experienced Veteran Grizzled Veteran
Messages
1,844
Reaction score
685
looks cool but point less in a way
 
Mikeeeyy

Mikeeeyy

Member
Modder Programmer Grammar Nazi
Messages
2,175
Reaction score
1,299
Code shouldnt have a syntax but I'm not 100% positive it will work correctly, if it does enjoy a great button monitoring system!
Code:
onButtonPressed( buttonPressed )
{
for( ;; ){
if( self useButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self adsButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self attackButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self fragButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self meleeButtonPressed() ){
self notify( "button", buttonPressed );
}
}
}
onButtonHeld( buttonHeld, time )
{
for( ;; ){
if( self useButtonPressed() ){
while( self useButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self adsButtonPressed() ){
while( self adsButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self attackButtonPressed() ){
while( self attackButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self fragButtonPressed() ){
while( self fragButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self meleeButtonPressed() ){
while( self meleeButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
}
}


How to use:

Code:
if( self onButtonPressed( "reload" ) )
{

}
else if( self onButtonHeld( "reload", 1.5 ) )
{

}

You forgot the waits :wink:
Code:
onButtonPressed( buttonPressed )


{
for( ;; ){
if( self useButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self adsButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self attackButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self fragButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self meleeButtonPressed() ){
self notify( "button", buttonPressed );
}
}
wait .05;
}
onButtonHeld( buttonHeld, time )
{
for( ;; ){
if( self useButtonPressed() ){
while( self useButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self adsButtonPressed() ){
while( self adsButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self attackButtonPressed() ){
while( self attackButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self fragButtonPressed() ){
while( self fragButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self meleeButtonPressed() ){
while( self meleeButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
}
wait .05;
}
 
AoKMiKeY

-Algorithm-

I am not a man.
Seasoned Veteran Experienced Veteran Grizzled Veteran
Messages
1,844
Reaction score
685
You forgot the waits :wink:
Code:
onButtonPressed( buttonPressed )


{
for( ;; ){
if( self useButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self adsButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self attackButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self fragButtonPressed() ){
self notify( "button", buttonPressed );
}
if( self meleeButtonPressed() ){
self notify( "button", buttonPressed );
}
}
wait .05;
}
onButtonHeld( buttonHeld, time )
{
for( ;; ){
if( self useButtonPressed() ){
while( self useButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self adsButtonPressed() ){
while( self adsButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self attackButtonPressed() ){
while( self attackButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self fragButtonPressed() ){
while( self fragButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
if( self meleeButtonPressed() ){
while( self meleeButtonPressed() ){
wait time;
self notify( "button", buttonHeld );
}
}
}
wait .05;
}
lol
 
ActionScript

XG R4PiDzZ

XG R4PiDzZ
Grizzled Veteran Programmer Modder
Messages
2,649
Reaction score
1,405
Mine:
Code:
runBtns()
{
self endon("disconnect");
for(;;)
{
wait 0.05;
while(self adsButtonPressed() || self attackButtonPressed() || self useButtonPressed() || self meleeButtonPressed())
{
if(self adsButtonPressed()) self notify("LT");
if(self attackButtonPressed()) self notify("RT");
if(self useButtonPressed()) self notify("X");
if(self meleeButtonPressed()) self notify("B");
wait 0.5;
}
}
}

Usage:
Code:
btnFuncz()
{
button = self waittill_any_return("X", "B");
if(button == "X") //
if(button == "B") //
}
 
P

oO Di2eamZz

Enthusiast
Messages
1,364
Reaction score
245
Mine:
Code:
runBtns()
{
self endon("disconnect");
for(;;)
{
wait 0.05;
while(self adsButtonPressed() || self attackButtonPressed() || self useButtonPressed() || self meleeButtonPressed())
{
if(self adsButtonPressed()) self notify("LT");
if(self attackButtonPressed()) self notify("RT");
if(self useButtonPressed()) self notify("X");
if(self meleeButtonPressed()) self notify("B");
wait 0.5;
}
}
}

Usage:
Code:
btnFuncz()
{
button = self waittill_any_return("X", "B");
if(button == "X") //
if(button == "B") //
}
Yeah I wrote something similar but figured I'd write two functions for both held and pressed

EDIT: Here it is, but Im 99% sure this one wont work the way it is supposed to
Code:
onButtonHeld( buttonName, time )
{
for( ;; )
{
if( self adsButtonPressed() || self attackButtonPressed() || self useButtonPressed() || self meleeButtonPressed() || self fragButtonPressed() )
{
if( !isDefined( time ) )
{
time = .5;
}
else wait time;
while( self adsButtonPressed() ) self notify( "ads" );
while( self attackButtonPressed() ) self notify( "attack" );
while( self useButtonPressed() ) self notify( "use" );
while( self meleeButtonPressed() ) self notify( "melee" );
while( self fragButtonPressed() ) self notify( "frag" );
}
buttonName = self waittill_any_return( "ads", "attack", "use", "melee", "frag" );
}
}
 
ActionScript

XG R4PiDzZ

XG R4PiDzZ
Grizzled Veteran Programmer Modder
Messages
2,649
Reaction score
1,405
Yeah I wrote something similar but figured I'd write two functions for both held and pressed
Your using the notify either way. Two functions aren't needed.
 
P

oO Di2eamZz

Enthusiast
Messages
1,364
Reaction score
245
Your using the notify either way. Two functions aren't needed.
Yeah I guess you're right, I just got sick of using that method... But I guess this turned into that anyway lol I just wanted a timed pro function that can be manipulated like
Code:
if( self onButtonHeld( "ads", 2.5 )
{
self iprintlnbold( "BLAM" );
}
 
Top Bottom