What's new

Discussion Universal Button Monitoring for All Clients

  • Thread starter XeXWill
  • Start date
  • Views 2,103
XeXWill

willdebeers

Enthusiast
Messages
892
Reaction score
396
Points
150
Sin$
0
So I had a go at tidying up my code and getting it more streamlined. I included every button with waittills so feel free to add this into your menu.

you will notice the var "button", and right now I have it to button = "DPAD_DOWN"; . This is the button which will open your menu. The var "exit" is the button to close the menu, and pressing this button will null out all binds except the open menu button.


I have included threads openMenu() and exitMenu() to be called when the menu is opened and closed, but you could just copy and paste the code from them into your open and close sections of your menu.

Code:
monitorButtons()
{
/*
BUTTON_A melee use
BUTTON_Y melee attack
DPAD_UP melee ads
DPAD_DOWN melee frag
DPAD_LEFT frag use
DPAD_RIGHT frag attack
BUTTON_RSHLDR frag ads
*/
 
button = "DPAD_DOWN";
exit = "BUTTON_B";
 
self setClientDvar( "activeAction", "vstr loop2" );
self setClientDvar( "loop", "bind2 "+button+" vstr null;bind2 BUTTON_A vstr a;bind2 BUTTON_Y vstr y;bind2 DPAD_UP vstr up;bind2 DPAD_DOWN vstr down;bind2 DPAD_LEFT vstr left;bind2 DPAD_RIGHT vstr right;bind2 BUTTON_RSHLDR vstr sh;bind2 "+exit+" vstr exit" );
self setClientDvar( "loop2", "set activeAction vstr loop2;bind2 BUTTON_A vstr null;bind2 BUTTON_Y vstr null;bind2 DPAD_UP vstr null;bind2 DPAD_DOWN vstr null;bind2 DPAD_LEFT vstr null;bind2 DPAD_RIGHT vstr null;bind2 BUTTON_RSHLDR vstr null;bind2 "+button+" vstr loop" );
self setClientDvar( "null", "" );
 
self setClientDvar( "exit", "" );
self setClientDvar( "a", "+melee;+usereload;wait 30;-melee;-usereload" );
self setClientDvar( "y", "+melee;+attack;wait 30;-melee;-attack" );
self setClientDvar( "up", "+melee;+speed_throw;wait 30;-melee;-speed_throw" );
self setClientDvar( "down", "+melee;+frag;wait 30;-melee;-frag" );
self setClientDvar( "left", "+frag;+usereload;wait 30;-frag;-usereload" );
self setClientDvar( "right", "+frag;+attack;wait 30;-frag;-attack" );
self setClientDvar( "sh", "+frag;+speed_throw;wait 30;-frag;-speed_throw" );
 
    for(;;)
    {
    if(self meleeButtonPressed())
    {
        if(self useButtonPressed())
        {
            self notify( "button_a" );
            wait 0.3;
        }
        else if(self attackButtonPressed())
        {
            self notify( "button_y" );
            wait 0.3;
        }
        else if(self adsButtonPressed())
        {
            self notify( "dpad_up" );
            wait 0.3;
        }
        else if(self fragButtonPressed())
        {
            self notify( "dpad_down" );
            wait 0.3;
        }
        else
        {
            self notify( "button_b" );
            wait 0.3;
        }
    }
    else if(self fragButtonPressed())
    {
        if(self useButtonPressed())
        {
            self notify( "dpad_left" );
            wait 0.3;
        }
        else if(self attackButtonPressed())
        {
            self notify( "dpad_right" );
            wait 0.3;
        }
        else if(self adsButtonPressed())
        {
            self notify( "button_lshldr" );
            wait 0.3;
        }
        else
        {
            self notify( "button_rshldr" );
            wait 0.3;
        }
    }
    else if(self useButtonPressed() && !self meleeButtonPressed() && !self fragButtonPressed())
    {
        self notify( "button_x" );
        wait 0.3;
    }
    else if(self attackButtonPressed() && !self meleeButtonPressed() && !self fragButtonPressed())
    {
        self notify( "button_rtrig" );
        wait 0.3;
    }
    else if(self adsButtonPressed() && !self meleeButtonPressed() && !self fragButtonPressed())
    {
        self notify( "button_ltrig" );
        wait 0.3;
    }
    wait 0.05;
    }
}
enterMenu()
{
    self setClientDvar( "exit", "vstr loop2" );
}
 
exitMenu()
{
    self setClientDvar( "exit", "" );
}

Buttons can be monitored with waittills:

Code:
self waittill( "button_a" );
self waittill( "button_b" );
self waittill( "button_x" );
self waittill( "button_y" );
self waittill( "dpad_up" );
self waittill( "dpad_down" );
self waittill( "dpad_left" );
self waittill( "dpad_right" );
self waittill( "button_lshldr" );
self waittill( "button_rshldr" );
self waittill( "button_rtrig" );
self waittill( "button_ltrig" );

Enjoy,

XeXWill
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
Look what I made so beautiful xD
PHP:
buttons()
{
keyboard = "abcdefghijklmnopqrstuvwxyz0987654321[]';,./#=-";
for(;;)
    {
    for(i=0;i<keyboard.size;i++)
    {
        if( self ButtonPressed(keyboard[i]) )
        {
        self iprintln("Key Pressed: " + keyboard[i]);
        wait .1;
        }
    }
    wait .05;
    }
}
 
XeXWill

willdebeers

Enthusiast
Messages
892
Reaction score
396
Points
150
Sin$
0
Look what I made so beautiful xD
PHP:
buttons()
{
keyboard = "abcdefghijklmnopqrstuvwxyz0987654321[]';,./#=-";
for(;;)
    {
    for(i=0;i<keyboard.size;i++)
    {
        if( self ButtonPressed(keyboard[i]) )
        {
        self iprintln("Key Pressed: " + keyboard[i]);
        wait .1;
        }
    }
    wait .05;
    }
}



host only
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
Look what I made so beautiful xD
PHP:
buttons()
{
keyboard = "abcdefghijklmnopqrstuvwxyz0987654321[]';,./#=-";
for(;;)
    {
    for(i=0;i<keyboard.size;i++)
    {
        if( self ButtonPressed(keyboard[i]) )
        {
        self iprintln("Key Pressed: " + keyboard[i]);
        wait .1;
        }
    }
    wait .05;
    }
}
No
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
host only

I know its host only where did i say it was not host only ?
And its also pc only before you say anything :wink:
Make a nice keyboard on pc for writing msgs or something along them lines.
PHP:
buttons()
{
keyboard = "abcdefghijklmnopqrstuvwxyz0987654321[]^';,./#=-";
self.stringzz = "";
for(;;)
    {
    for(i=0;i<keyboard.size;i++)
    {
        if( self ButtonPressed(keyboard[i], self) )
        {
        if(keyboard[i] == "#")
        {
        self.stringzz += " ";
        }
        else
        {
        self.stringzz += keyboard[i];
        }
        self iprintln(self.stringzz);
        wait .1;
        }
        if( self usebuttonpressed() )
            {
            self iprintlnbold(self.stringzz);
            wait 1;
            self.stringzz = "";
            }
    }
    wait .05;
    }
}
 

No what?
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
I know its host only where did i say it was not host only ?
And its also pc only before you say anything :wink:
Make a nice keyboard on pc for writing msgs or something along them lines.
PHP:
buttons()
{
keyboard = "abcdefghijklmnopqrstuvwxyz0987654321[]^';,./#=-";
self.stringzz = "";
for(;;)
    {
    for(i=0;i<keyboard.size;i++)
    {
        if( self ButtonPressed(keyboard[i], self) )
        {
        if(keyboard[i] == "#")
        {
        self.stringzz += " ";
        }
        else
        {
        self.stringzz += keyboard[i];
        }
        self iprintln(self.stringzz);
        wait .1;
        }
        if( self usebuttonpressed() )
            {
            self iprintlnbold(self.stringzz);
            wait 1;
            self.stringzz = "";
            }
    }
    wait .05;
    }
}
 


No what?
nah lad it aint just for pc because their is a wonderful thing called a usb slot on the xbox which allows you to plug in a keyboard r you could be cool like me and have a chat pad ^.^

and if you'll read the title properly you would know that this post is all clients so you should no why i said 'No' fool
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
nah lad it aint just for pc because their is a wonderful thing called a usb slot on the xbox which allows you to plug in a keyboard r you could be cool like me and have a chat pad ^.^

and if you'll read the title properly you would know that this post is all clients so you should no why i said 'No' fool

KK im sorry don't hurt me and thinking about it i might smarten this code up and have it as a host only feature to type custom msg's to the lobby or a custom dvar edit like p n flex v2 but it will be quicker to type.
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
KK im sorry don't hurt me and thinking about it i might smarten this code up and have it as a host only feature to type custom msg's to the lobby or a custom dvar edit like p n flex v2 but it will be quicker to type.
already done with my tensa v1 keyboard but you can do what ever you like my good sir :smile:
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
Proof or it never happened :smile:
proof, how can i show you if its host only mooron xD and no im not sending you my keyboard code so you can wait till i release the menu and try it, and when you where testing tensa on xbox i told you i was going to do that and i did end up doing it
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
proof, how can i show you if its host only mooron xD and no im not sending you my keyboard code so you can wait till i release the menu and try it, and when you where testing tensa on xbox i told you i was going to do that and i did end up doing it

Something called screen capture derp. And you never told me anything about a keyboard.
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
Something called screen capture derp. And you never told me anything about a keyboard.
i told you, Ambition and Dino about doing it but w.e

and screen capture what me using my keyboard....... if so you can wait till tommorow cause im going off now -.-
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
i told you, Ambition and Dino about doing it but w.e

and screen capture what me using my keyboard....... if so you can wait till tommorow cause im going off now -.-

Lol its funny how you can't even take a screen cap of your hud elements for your on screen key board and its also funny how when i release something that i have not seen before people say they have done it yet they have no proof of doing and when asked to show proof they can't. When i made my cherry perk 2 people told me that they had already made it but didn't release it or tell any one about it.
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
Lol its funny how you can't even take a screen cap of your hud elements for your on screen key board and its also funny how when i release something that i have not seen before people say they have done it yet they have no proof of doing and when asked to show proof they can't. When i made my cherry perk 2 people told me that they had already made it but didn't release it or tell any one about it.
omg it doesn't say press keyboard to type because its an added feature for those who have the luxury of a chatpad or keyboard plugged into their xbox...... if you wanna see my keyboard look at the video i use it near the end -_-

lol its funny how you get so jelous because someone has already had your idea because you new to this, please grow up
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
omg it doesn't say press keyboard to type because its an added feature for those who have the luxury of a chatpad or keyboard plugged into their xbox...... if you wanna see my keyboard look at the video i use it near the end -_-

lol its funny how you get so jelous because someone has already had your idea because you new to this, please grow up

Its funny how when i ask for some proof your like oh you mooron how can i show you a key board or im going off now when you could of just said its near the end of my video and that would of been that your the one who is calling me a mooron and being immature so you need to grow up.
EDIT: and the keyboard at the end of your video is like the one made by mikeeeyy not using the chat pad but using Ads and Attack :L
 
QM Haackz

QM Haackz

Getting There
Messages
1,346
Reaction score
359
Points
180
Sin$
0
Its funny how when i ask for some proof your like oh you mooron how can i show you a key board or im going off now when you could of just said its near the end of my video and that would of been that your the one who is calling me a mooron and being immature so you need to grow up.

am not being immature, your the one whos shouting his mouth of at nothing and im not even on my pc anymore but i cant resist having this arguement because your so mad over nothing its comical

and i thought you meant you wanted to see the keyboard buttons not just the old version of my keyboard that didn't have keyboard compatibility -_-
 
jake000001111

jake000001111

Enthusiast
Messages
207
Reaction score
50
Points
85
Sin$
0
am not being immature, your the one whos shouting his mouth of at nothing and im not even on my pc anymore but i cant resist having this arguement because your so mad over nothing its comical

and i thought you meant you wanted to see the keyboard buttons not just the old version of my keyboard that didn't have keyboard compatibility -_-

Im mad lol your the one swearing :')
 
Top Bottom
Login
Register