Binding to a double button ??

Games such as RTCW, Call of Duty, Quake ect.

Moderators: [AsC]Frags, [FuN] Users, Senior Moderators, Friends of [FuN]

Binding to a double button ??

Postby Hyper » Tue Nov 25, 2003 1:17 am

Hi peeps,
was wondering if its possible to bind to a double button press in E.T. ?
theres so many vsaycommands id like to set but dont want to use the whole keyboard.
I was thinking of using the KP numbers... I.E. 1.1 would say "I need ammo", 1.2 would say "I need a medic" ect ect ... that way i could bind all the vsay commands using just a few keys.
I'm not used to code in any shape or form... but if you could post 2 examples that should get me going )

Thanks in advance
Hyper.
Hyper
Junior Member
Junior Member
 
Posts: 19
Joined: Sun Nov 16, 2003 6:33 pm
Location: West Sussex

Postby Captain Darling » Tue Nov 25, 2003 4:29 pm

I'm doing this from my head, so don't shoot me if it's not 100% accurate. I also don't have a wolf installed here to try it. I'll post a fully functional one later tonight (or tomorow). I only done it for 3 keys at the moment

First of all these are the name to use for the numeric keypad

KP_INS - 0
KP_END - 1
KP_DOWNARROW - 2
KP_PGDN - 3
KP_LEFTARROW - 4
KP_5 - 5
KP_RIGHTARROW - 6
KP_HOME - 7
KP_UPARROW - 8
KP_PGUP - 9

and here's some script (the white lines are comment. You can put those in the script file to make it more easy to read. Just remember to add the leading //. The red text is the actuall script & the green text is an attempt to explain what it does)

//bind key1 so the other keys will be bound to vsays when you press it (it will also bind key1 to unbind so you can cancel the vsay by pressing 1 again)

bind KP_END "vstr prepbinds"

This will bind the numeric 1 key to execute 'prepbinds' (defined below)

//prepare the vsays by binding the numeric keys

set prepbinds "bind KP_END vstr unbindvsays; bind KP_RIGHTARROW vstr vsay_key2;bind KP_PGDN vstr vsay_key3; bind KP_LEFTARROW vstr vsay_key4"

when we execute 'prepbinds', the 1 key will be bound to 'unbind', the 2 key will be bound to 'vsay_key2' (defined later), and so on

//for each key, do a vsay & unbind the keys when done

set vsay_key2 "vsay thanks; vstr unbindvsays"
set vsay_key3 "vsay sorry; vstr unbindvsays"
set vsay_key4 "vsay oops; vstr unbindvsays"


when vsay_key2 is executed, it will do a vsay (thanks/danke) and then will unbind all the keys, so you can start again by pressing the 1 key, same goes for the other keys

//this will remove the binds after you done a vsay, or when you press the 1 key again

set unbindvsays "bind KP_END vstr prepbinds;unbind KP_DOWNARROW; unbind KP_PGDN; unbind KP_LEFTARROW"

this will be executed after a vsay (through the vsay_keyx vstrs) or when we press the 1 key for the second time. It rebinds key1 to 'prepbinds' so we can start again


Captain Darling
User avatar
Captain Darling
Senior Member
Senior Member
 
Posts: 107
Joined: Sat May 17, 2003 5:42 pm
Location: Belgium

Postby Hyper » Tue Nov 25, 2003 5:35 pm

Excellent work)
Thanks again Cpt.D ,im useless with code, but your reply actually makes sense , ever thought of becomming a teacher ? :P
Ill play with those scripts for a while.

BIG Thanks

HYPER

p.s. I'd never shoot someone trying to help me :)
Hyper
Junior Member
Junior Member
 
Posts: 19
Joined: Sun Nov 16, 2003 6:33 pm
Location: West Sussex

Postby Hyper » Tue Nov 25, 2003 6:29 pm

Woot ... your script works well, I had to make a small adjustment to the second line of script.... you had accidentally typed RIGHTARROW instead of DOWNARROW.... took me a little bit of staring at the text to suss out why it wasn’t fully functional, going to play with it now and try and add more keys )))

Thx Again

HYPER
Hyper
Junior Member
Junior Member
 
Posts: 19
Joined: Sun Nov 16, 2003 6:33 pm
Location: West Sussex

Postby Hyper » Tue Nov 25, 2003 6:53 pm

Now I’m proud of myself :) using your easy to follow instructions, I have managed to add more keys to the script.

There’s no stopping me now :p
Thx C.D.

HYPER
Hyper
Junior Member
Junior Member
 
Posts: 19
Joined: Sun Nov 16, 2003 6:33 pm
Location: West Sussex

Postby Hyper » Tue Nov 25, 2003 7:47 pm

ha ha....spoke too soon :lol: I can add to the script right up to 1:9 ... its when I try to move on to 2:1, 2:3, 2:4 ect is where things get somewhat over my head.
I thought it would be a simple case of copying the code.... but thinking about it (with my limited knowledge) it probably needs a script to say that when i press the KP DOWNARROW first, it has to ignore the previous script written/start a new one.... Or something like that /boggle

So ill patiently wait for you post the full script :D

HYPER
Hyper
Junior Member
Junior Member
 
Posts: 19
Joined: Sun Nov 16, 2003 6:33 pm
Location: West Sussex

Postby Hyper » Tue Nov 25, 2003 9:43 pm

I wish you had an "edit" button on this site :P

Sorry for all the Spam.

Ive managed to do exactly what i wanted... with a lot of help from the posts on this site.

I looked at OutCastNL http://members.home.nl/outcast-nl/main.htm wonerfull site and scaled down and ajusted his Easyvoice script.

I realy hope he doesnt mind :D

I wouldnt have been able to understand what was going on without your help C.D. so once again I thank you.

HYPER
Hyper
Junior Member
Junior Member
 
Posts: 19
Joined: Sun Nov 16, 2003 6:33 pm
Location: West Sussex

Postby OutCast**NL » Sun Mar 21, 2004 3:53 pm

NP M8

:lol:
OutCast**NL
Junior Member
Junior Member
 
Posts: 14
Joined: Mon Apr 14, 2003 10:54 am
Location: Heerlen NL


Return to First Person Shooter

Who is online

Users browsing this forum: No registered users and 66 guests