What key was pressed

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

What key was pressed

Post by bdbodger »

I have seen local.player.useheld to find out if the player is holding the use key but what I want is to be able to tell what keys the players are useing . Lets say I wanted to script a object to move by the players keyboard sort of like remote control can I do this ? Can you do local.player.forwardheld? or local.player.leftheld? or local.player.turnleftheld ?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Yes

Post by tltrude »

Yes you can, but you have to use the correct name for the command. The command given by the right mouse button is:

MOUSE2 "+attacksecondary"

Players can change "attacksecondary" to another key in thier options, but the command will always be "attacksecondary". Here is a list of all commands:

cmdlist
-back
-moveright
-leanright
-use
set
popmenu
pushmenu
devcon
gotoreturnmenu
setreturnmenu
-statistics
+statistics
ui_getplayermodel
ui_applyplayermodel
playermodel
finishloadingscreen
startserver
ui_removehud
ui_addhud
locationprint
centerprint
ui_checkrestart
ui_resetcvars
ui_hud
clear
ui_testlist
ui_loadconsolepos
ui_saveconsolepos
ui_hidemouse
ui_showmouse
inv_restart
editspecificshader
editshader
editscript
notepad
soundpicker
lod_spawnlist
viewspawnlist
ui_startdmmap
dmmapselect
maplist
loadmenu
togglemenu
listmenus
globalwidgetcommand
widgetcommand
hidemenu
showmenu
forcemenu
pushmenu_dm
pushmenu_sp
tmstop
tmstartloop
tmstart
pitch
playsong
loadsoundtrack
stopmp3
playmp3
sounddump
soundinfo
soundlist
play
ff_disable
r_infoworldtris
r_infostaticmodels
farplane_info
gfxinfo
screenshot
modelist
modellist
shaderlist
imagelist
cl_dumpallclasses
cl_dumpclassevents
cl_classevents
cl_classtree
cl_classlist
cl_pendingevents
cl_dumpevents
cl_eventhelp
cl_eventlist
gogetpatch
launchgamespy
fastconnect
aliasdump
dialog
saveshot
vidmode
tiki
animlist
tikilist
tikianimlist
ping
setenv
rcon
localservers
reconnect
menuconnect
connect
stoprecord
cinematic
disconnect
vid_restart
snd_restart
clientinfo
configstrings
cmd
-cameralook
+cameralook
+togglemouse
-mlook
+mlook
-button14
+button14
-button13
+button13
-button12
+button12
-button11
+button11
-button10
+button10
-button9
+button9
-button8
+button8
-button7
+button7
-button6
+button6
-button5
+button5
-button4
+button4
-button3
+button3
-button2
+button2
-button1
+button1
-button0
+button0
-speed
+speed
+leanright
-leanleft
+leanleft
+use
-attacksecondary
+attacksecondary
-attackprimary
+attackprimary
-attack
+attack
+moveright
-moveleft
+moveleft
-strafe
+strafe
-lookdown
+lookdown
-lookup
+lookup
+back
-forward
+forward
-right
+right
-left
+left
-movedown
+movedown
-moveup
+moveup
centerview
difficultyHard
difficultyMedium
difficultyEasy
loadlastgame
loadgame
autosavegame
savegame
killserver
gamemap
devmap
map
spdevmap
spmap
sectorlist
restart
dumpuser
systeminfo
serverinfo
status
clientkick
kick
heartbeat
midiinfo
net_restart
in_restart
pause
writeconfig
changeVectors
quit
exec
bind
alias
seta
unbindall
touchFile
cd
fdir
dir
path
ctrlbindlist
altbindlist
bindlist
unctrlbind
ctrlbind
unaltbind
altbind
unbind
append
scale
subtract
add
cvar_savegame_restart
cvar_restart
cvarlist
reset
setu
sets
toggle
wait
echo
vstr
meminfo

239 commands
Tom Trude,

Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

No, actually you can't get any "is this button held" type of command other than useheld or fireheld. However, what you CAN do is modify the state files (global/X.st in Pak0), and create new states which happen in certain conditions. For example, if you wanted to create a "crouchheld" state, you can add this:
//==============================================================================
//==============================================================================
//
// Stand (really means not doing an action)
//
//==============================================================================

state STAND
{
movetype legs

camera behind

entrycommands
{
viewmodelanim idle
}

action
{
none : default // no torso animation
}

states
{
CROUCHING : +CROUCH
NOTCROUCHING : -CROUCH

KILLED : KILLED
PAIN : PAIN

VEHICLE_START : IS_USING_VEHICLE
TURRET_START : IS_USING_TURRET

// if we're on a ladder, make sure we're climbing the ladder
LADDER_IDLE_LEFT : ON_LADDER

// Some grab and hang stuff will be implemented in the final game, probably
// not all of this, but it's in here as a placeholder.
// CLIMB_LADDER : ONGROUND +FORWARD !BACKWARD AT_LADDER

// CLIMB_LADDER_IMPACT : !ONGROUND FORWARD !BACKWARD AT_LADDER // For grabbing onto walls when
// flying through the air

// Using objects is dictated by the object being used. The three objects
// here are for objects which trigger interactive actions when touched,
// for objects which the player uses (such as doors), and for when the
// player tries to use an object that is not usable.
// USE_USEANIM : ONGROUND TOUCHEDUSEANIM
// USE_USEANIM : ONGROUND USE AT_USEANIM
USE_LADDER : ONGROUND +USE AT_LADDER CHECK_HEIGHT "stand"
// USE_LADDER : ONGROUND AT_LADDER // this is full auto use of ladders
// latch onto ladder in mid-air
USE_LADDER : +USE AT_LADDER CHECK_HEIGHT "stand" // can also latch onto a ladder in mid-air
// auto use of ladder when at the bottom (AT_LADDER check is last because it does a trace)
USE_LADDER : ONGROUND FORWARD LOOKING_UP "35" !PUTAWAYMAIN !NEW_WEAPON !RELOAD !ATTACK_PRIMARY !ATTACK_SECONDARY AT_LADDER CHECK_HEIGHT "stand"
// auto use of ladder when at the top (AT_LADDER check is last because it does a trace)
USE_LADDER : ONGROUND FORWARD !LOOKING_UP "-35" !PUTAWAYMAIN !NEW_WEAPON !RELOAD !ATTACK_PRIMARY !ATTACK_SECONDARY AT_LADDER CHECK_HEIGHT "stand"
// GENERIC_USE : ONGROUND +USE

// This is not functional for the prototype, but is here as a placeholder for
// future functionality.
// While the player can only fire weapons with his right hand, he can switch them
// to his left if he wants to use an item with his left. Gameplay-wise, this should
// be the same as putting the weapon away, but it will create a nice graphical "cool
// factor" which is always good in computer games.
// When we have two items out, the game code will flag them both as putaway, and we
// need to put the right one away first, followed by the left.
PUTAWAY_MAIN : PUTAWAYMAIN // Basic put weapon away move.
RAISE_WEAPON : NEW_WEAPON

RELOAD_WEAPON : RELOAD

CHECK_PRIMARY_ATTACK_SEMIAUTO : +ATTACK_PRIMARY IS_WEAPON_SEMIAUTO "mainhand" IS_WEAPON_READY_TO_FIRE "mainhand"
CHECK_PRIMARY_ATTACK_FULLAUTO : ATTACK_PRIMARY !IS_WEAPON_SEMIAUTO "mainhand" IS_WEAPON_READY_TO_FIRE "mainhand"
CHECK_SECONDARY_ATTACK : +ATTACK_SECONDARY
}
}

state CROUCHING
{
entrycommands
{
exec global/crouchheld.scr
}
}

state NOTCROUCHING
{
entrycommands
{
exec global/notcrouchheld.scr
}
}
Then for crouchheld.scr:

Code: Select all

main:

    parm.other.crouchheld = 1
    end
and vice versa...

But I think it's a little more advanced than you would want it to be... :cry:
User avatar
HappyChappy_7000
Warrant Officer
Posts: 146
Joined: Thu Jul 10, 2003 1:14 pm
Location: Australia
Contact:

Post by HappyChappy_7000 »

Check out one of Scorpio's map (The one with flyable planes,drivable tanks and trucks) :wink:
He use's ,useheld ,fireheld ,forwadheld etc.
What? You know who I am?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I didn't see a map by scorpio in the new maps forum do you have a link?
brendank310
Corporal
Posts: 27
Joined: Mon Apr 07, 2003 11:02 am
Contact:

Post by brendank310 »

check it out in tmt
Sgt.Pepper
Sergeant
Posts: 69
Joined: Tue Feb 25, 2003 5:41 pm
Location: Canada

Post by Sgt.Pepper »

Wait a moment, could this be done through a trigger multiple? The player enters a trigger and then you could script them to do all kinds of funky stuff.

I'm thinking of the part that Alcoholic wrote:

parm.other.crouchheld = 1

Only with a list of commands. Or even with a quit, so that it could be used as a map fix for someone trying to abuse glitches.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

You mean as in forcing a player to type 'quit' in the console? :twisted:
Sgt.Pepper
Sergeant
Posts: 69
Joined: Tue Feb 25, 2003 5:41 pm
Location: Canada

Post by Sgt.Pepper »

Yeah, pretty much. I have a map fix on our server that causes the player to say something silly when they try to abuse the glitches, and am wondering if I can take it to another level. Disconnect would probably be better, it would save the admins from having to kick a person, but it could be interesting seeing what could be done.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I looked at scorpio's tanks he has a custom mike.st that is why he is able to use forwardheld . Useheld works without the custom mike.st though
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

Yeah useheld and fireheld are already in.
Post Reply