new keys?

Post your scripting questions / solutions here

Moderator: Moderators

lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

i noticed unbindall in unnamedsoldier.cfg, so will custom.cfg just add onto unnamedsoldier.cfg? not replace it?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

It is loaded after unnamedsoldier.cfg this is the one I use it was written for me and I don't use most of it .

Code: Select all

//==========================================================
// THIS IS Bodger2'S ALIAS SCRIPTS CONFIG FILE FOR MOHAA //
//==========================================================
//
// ********HOW TO ADD NEW BIND ITEMS TO THE CONTROLS MENU**********
//
// 1) Add the name and alias name to BIND.SCR(FOUND IN THE UI FOLDER OF THIS PK3) IE:binditem <name>"Crouch and Fire Toggle"<alias>"crftog"
//      -this will add the NAME of the new item to the CONTROLS MENU,and link it to its ALIAS
//
// 2) Add the ALIAS to this config file(See TOGGLE ALIAS SCRIPTS/Crouch and Fire Toggle below) IE:alias hairmenu "togglemenu crosshair_menu"
//        - < alias >space< alias name-MAKE ONE UP >space< "command value;command value;etc; in quotation marks" >
//        -make sure that you are using the MAIN ALIAS from the script in UI/binds.scr
//
// 3) That it, you can now bind the new item to your favorite key in the CONTROLS MENU
//
// 4) Optional- You can PRE BIND the alias in your custom.cfg if you have one (IE:bind x "crftog")
//
//==========================================================================

echo "Custom.cfg loading" //shows in console when file is loading

//==========================================================================

// SINGLE LINE ALIAS SCRIPTS
//==========================
alias 3rd "toggle cg_3rd_person;cg_cameraverticaldisplacement 0;cg_cameradist 150;cg_cameraheight 0"

alias heal "fullheal;locationprint 275 100 HEALTH-100 0"

alias god "dog;locationprint 275 100 GOD-MOD 0"

alias allwep "wuss;locationprint 275 100 ALL-WEAPONS 0"

alias hairtog "toggle ui_crosshair;locationprint 275 100 TOGGLE-CROSSHAIR 0"

alias hairmenu "togglemenu crosshair_menu"

alias jallies "join_team allies"

alias jaxis "join_team axis"

alias con "pushmenu Controls"

alias servlist "pushmenu joinnetgame;wait 250;widgetcommand netgamelist refreshserverlist"

// TOGGLE ALIAS SCRIPTS
//=======================


// Crouch and Fire Toggle
alias +crfire "+movedown; +attackprimary"
alias -crfire "-attackprimary; -movedown"

alias crfireon "bind mouse1 +crfire; alias crftog crfireoff; locationprint 275 100 Crouch-&-Fire+ON 0"
alias crfireoff "bind mouse1 +attackprimary; alias crftog crfireon; locationprint 275 100 Crouch-&-Fire-OFF 0"

alias crftog crfireon // <-- ****THIS IS THE MAIN ALIAS - crftog will be placed in UI/BINDS.SCR IN THIS PK3 -SEE HOW TO AT TOP OF PAGE****

//THIS IS THE TOGGLE            ******NOTICE THAT THE BIND HAS BEEN COMMENTED // OUT***************
//bind kp_minus "crftog"                YOU DO NOT NEED TO ADD THE BIND KEY HERE
//                                      YOU WILL BE BINDING IN THE CONTROLS MENU

//======================================

// Fog Toggle
alias fogoff "alias fogtog fogon;set r_farplane 60000;set r_farplane_nofog 1;set r_farplane_nocull 1;set r_light_nolight 1"
alias fogon "alias fogtog fogoff;set r_farplane 0;set r_farplane_nofog 0;set r_farplane_nocull 0;set r_light_nolight 0"

alias fogtog "fogoff"

//====================================

// Fast Pistol Toggle
alias hf1 "hud_fastswitch 1"
alias hf0 "hud_fastswitch 0"

alias pistolon "bind mouse2 +pist; alias fpist pistoloff;locationprint 275 100 Fast-Pistol+ON 0"
alias pistoloff "bind mouse2 +attacksecondary; alias fpist pistolon;locationprint 275 100 Fast-Pistol-OFF 0"

alias +pist "hf1; useweaponclass pistol; hf0"
alias -pist "hf1; uselast; hf0"

alias fpist pistolon

//===================================

//Grenade Toss Toggle
alias +gt0 "say *35; useweaponclass grenade" //say *35 is grenade take cover,for Spearhead it would be say *45
alias -gt0 "uselast"

alias gton "bind mouse2 +gt0; alias gttog gtoff;locationprint 275 100 Grenade-Toss+ON 0"
alias gtoff "bind mouse2 +attacksecondary; alias gttog gton;locationprint 275 100 Grenade-Toss-OFF 0"

alias gttog gton

//==================================

// Quick Binoculars Toggle
alias hf1 "hud_fastswitch 1"
alias hf0 "hud_fastswitch 0"

alias qbon "bind mouse2 +item; alias qbtog qboff;locationprint 275 100 Quick-Binoculars-ON 0"
alias qboff "bind mouse2 +attacksecondary; alias qbtog qbon;locationprint 275 100 Quick-Binoculars-OFF 0"

alias +item "hf1; toggleitem; hf0"
alias -item "hf1; uselast; hf0"

alias qbtog qbon

//================================

// Swatmans Accuracy Sniper script
alias +scopeless "+attacksecondary; +attackprimary"
alias -scopeless "-attacksecondary; -attackprimary; wait; wait; +attacksecondary; -attacksecondary"

alias snipe "+attacksecondary; -attacksecondary; bind mouse1 +attackprimary; bind mouse2 nosnipe"
alias nosnipe "+attacksecondary; -attacksecondary; bind mouse1 +scopeless; bind mouse2 snipe"

alias scopeless2 "bind mouse1 +scopeless; bind mouse2 snipe; alias astog scope2;locationprint 275 100 ACCURATE-SNIPER-ON 0"
alias scope2 "bind mouse1 +attackprimary; bind mouse2 +attacksecondary; alias astog scopeless2;locationprint 275 100 ACCURATE-SNIPER-OFF 0"

alias astog scopeless2

//=================================

// Maggots Crouching script
alias w5 "wait;wait;wait;wait;wait"
alias w10 "w5;w5"

alias -crouch "-movedown;+moveup;w10;-moveup"
alias +crouch "+movedown;wait"

// Developer Tools
//=================

//decals menu
alias dcal "pushmenu decals"

//shows circles lines
alias eid "set g_entinfo 0;alias eitog eia;locationprint 275 100 ENITY-INFO-TOGGLE 0"
alias eic "set g_entinfo 1;alias eitog eid;locationprint 275 100 ENITY-INFO-TOGGLE 0"
alias eib "set g_entinfo 2;alias eitog eic;locationprint 275 100 ENITY-INFO-TOGGLE 0"
alias eia "set g_entinfo 3;alias eitog eib;locationprint 275 100 ENITY-INFO-TOGGLE 0"
alias eitog "eia"

//shows trianglular lines
alias trisd "set r_showtris 3;alias tristog trisa;locationprint 275 100 TRIS-TOGGLE 0"
alias trisc "set r_showtris 2;alias tristog trisd;locationprint 275 100 TRIS-TOGGLE 0"
alias trisb "set r_showtris 1;alias tristog trisc;locationprint 275 100 TRIS-TOGGLE 0"
alias trisa "set r_showtris 0;alias tristog trisb;locationprint 275 100 TRIS-TOGGLE 0"
alias tristog "trisa"
alias showport "r_showportal 1"

alias fly "noclip;locationprint 275 100 NO-CLIP-TOGGLE 0"

alias notar "notarget;locationprint 275 100 NO-TARGET-TOGGLE 0"

alias dvl "togglemenu leveldesign"

alias cam "togglemenu camera"

alias anm "togglemenu animate2"

alias emm "togglemenu emitter"

alias zm "togglemenu zound"

alias smm "togglemenu smoke"

alias cml "+cameralook"

alias ems "editscript"

alias blt+ "set g_numdebuglinedelays 30; set g_showbullettrace 1;alias bulleton blt-;locationprint 275 100 BULLET-TRACE-DEBUGGER-ON 0"
alias blt- "set g_numdebuglinedelays 0; set g_showbullettrace 0;alias bulleton blt+;locationprint 275 100 BULLET-TRACE-DEBUGGER-OFF 0"
alias bulleton "blt+"


//=======================================================================================================================================================


// Say Commands//  MOHAA {spearhead say command are different,add 10 to most these sayings}
//=============

// SQUAD COMMANDS
alias s11 "say *11"	//Squad,move in

alias s12 "say *12"	//Squad,fall back

alias s13 "say *13"	//Squad,attack right flank

alias s14 "say *14"	//Squad,attack left flank

alias s15 "say *15"	//Squad,hold this position

alias s16 "say *16"	//Squad,covering fire

alias s17 "say *17"	//Squad,regroup

// TEAM COMMANDS
alias s21 "say *21"	//Cover me

alias s22 "say *22"	//I'll cover you

alias s23 "say *23"	//Follow me

alias s24 "say *24"	//You take Point

alias s25 "say *25"	//You take lead

alias s26 "say *26"	//Taking fire,need some help

alias s27 "say *27"	//Charge

alias s28 "say *28"	//Attack

alias s29 "say *29"	//Open fire

// INDIVIDUAL COMMANDS		
alias s31 "say *31"	//Yes sir
	
alias s32 "say *32"	//No sir

alias s33 "say *33"	//Enemy spotted

alias s34 "say *34"	//Sniper

alias s35 "say *35"	//Grenade take cover

alias s36 "say *36"	//Area clear

alias s37 "say *37"	//Great Shot

alias s38 "say *38"	//Thanks

alias s39 "say *39"	//I owe ya one

// TAUNTS
alias s41 "say *41"	//Is that all you got

alias s42 "say *42"	//I think the germans are out of real men

alias s43 "say *43"	//Go on and run ,you yellow bellies

alias s44 "say *44"	//They're a bunch of cowards

alias s45 "say *45"	//Come back when you've had some target practice

alias s46 "say *46"	//Come Prepared next time

alias s47 "say *47"	//Try again

alias s48 "say *48"	//I've seen french school girls shoot better

alias s49 "say *49"	//That made a mess

// TEAM TAUNTS
alias s51 "say *51"	//He's going to get us killed

alias s52 "say *52"	//A lot of good men are going to die because of his poor leadership

alias s53 "say *53"	//Good Riddance

alias s54 "say *54"	//That guy is going to get us all killed

alias s55 "say *55"	//Hey buddy get down

alias s56 "say *56"	//Stay out of my foxhole,pal

alias s57 "say *57"	//Find your own hiding place

alias s58 "say *58"	//Get out of my way

//===================================

//crosshair on
seta ui_crosshair 1

// compass
seta ui_compass_scale 0.5


echo "Custom.cfg loaded" //shows in console when file finished loading

//EOF
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

here's the relevant bits of the script...

Code: Select all

main:

level waittill prespawn
level waittill spawn

thread Squad_Main

end

Squad_Main:

level.squadIsCommandable = TRUE // initializes the squad commandable.

thread commandListener
end

commandListener:
// listens for command from the player while active.
// inactivated if squad isn't commandable.

while(level.squadIsCommandable == TRUE)
{

   if (getcvar(squadcommand) != "") 
   { 
      switch(getcvar(squadcommand)) 
      { 
        case "hold"		:	iprintln "SQUAD HOLD ORDER DETECTED"
					//thread command_HOLD
	   break; 	
	case "coverFire"	:	iprintln "SQUAD COVER FIRE ORDER DETECTED"
					//thread command_COVER
	   break;
	case "follow"		:	iprintln "SQUAD FOLLOW ORDER DETECTED"
					//thread command_FOLLOW
	   break;
	case "advance"		:	iprintln "SQUAD ADVANCE ORDER DETECTED"
					//thread command_ADVANCE
	   break;
	case "regroup"		:	iprintln "SQUAD REGROUP ORDER DETECTED"
					//thread command_REGROUP
	   break;
 
      } 
   } 
   wait 1 
} 

end
and my entire custom.cfg

i get the idea of aliases now, and binding them. i just don't understand why this isn't working. :x

Code: Select all

alias squad_hold "setcvar squadcommand hold"
alias squad_coveringFire "setcvar squadcommand coveringFire"
alias squad_follow "setcvar squadcommand followme" 
alias squad_advance "setcvar squadcommand advance"
alias squad_regroup "setcvar squadcommand regroup"
//alias clear "setcvar squadcommand  "
 
bind HOME squad_hold
bind END squad_coveringFire
bind DEL squad_follow
bind PGUP squad_advance
bind PGDN squad_regroup
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

setcvar is a scripting command try set
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Yeah. Exactly. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

already tried it.

what happens is nothing, no errors in devcon and nothing happens when i hit the keys.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Yeah, right... :? Put this code:

Code: Select all

alias squad_hold "set squadcommand hold"
alias squad_coveringFire "set squadcommand coveringFire"
alias squad_follow "set squadcommand followme"
alias squad_advance "set squadcommand advance"
alias squad_regroup "set squadcommand regroup"
 
bind HOME squad_hold
bind END squad_coveringFire
bind DEL squad_follow
bind PGUP squad_advance
bind PGDN squad_regroup
into your custom.cfg and press any of the bound keys. Bring the console and type squadcommand. You'll see it does work.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

ok, put that script in, saved, checked the code, no errors in console.

didn't work.

i bound it via console with the EXACT SAME LINE and it worked. (bind PGUP "set squadcommand advance")

so my custom.cfg is messed?

on the same note, i thought that grenade one could be really nice, so i basically edited it so it didn't mess my binding keys since i have very specific binds... most all of my keyboard has a bind.

it doesn't work either.

Code: Select all

// made for the Second Squad modification by lizardkid
// PURPOSE: set cvars to a global cvar and it is detected and an action is performed.

echo "Custom.cfg loading"

alias squad_hold "set squadcommand hold" 
alias squad_coveringFire "set squadcommand coveringFire" 
alias squad_follow "set squadcommand followme" 
alias squad_advance "set squadcommand advance" 
alias squad_regroup "set squadcommand regroup" 
  
bind HOME squad_hold 
bind END squad_coveringFire 
bind DEL squad_follow 
bind PGUP squad_advance 
bind PGDN squad_regroup

//Grenade Toss Toggle (like CoD)
alias +gt0 "useweaponclass grenade" //say *35 is grenade take cover,for Spearhead it would be say *45 
alias -gt0 "uselast; say *35" 

alias codnade "+gt0; +attackprimary; -gt0"

bind q codnade


echo "Custom.cfg loaded SUCCESSFULLY!"
it would seem to work, but it doesnt. NONE of them work... this is really weird.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

yea,everytime i binded somthing from console,it ended up in my .cfg :?
Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

now what would explain something like set alias "dog" "say IM A CHEATING LITTLE ******* KICK ME!!!!! KICK ME!!!!!" appearing in my cfg file?
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

the unnamedsoldier.cfg is where it keeps all binds for permanent use ;)

i put all that into my unnamedsoldier.cfg (including nade thing) and it wall works, but custom.cfg, for some reason, refuses to work at all.

btw, with that nade thing, i used this, and it doesn't work exactly right. it brings nade up, cocks it, and, and.. holds it and freezes my weaponry.

Code: Select all

alias +gt0 "locationprint 275 100 THROWING 0; useweaponclass grenade; wait .6; +attackprimary; wait .8; say *35; +uselast"
alias codnade "+gt0"
the custom thing can wait until the end part of the script, but it would be nice to be able to make it work now.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Code: Select all

alias +gt0 "locationprint 275 100 THROWING 0; useweaponclass grenade; wait .6; +attackprimary; wait .8; -attackprimary; say *35; +uselast"
alias codnade "+gt0"
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

it wud be cool if jv made some bots that responded to ur commands. and u cud have a team in MP with bot support u command! weeee.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

when i finish my Second Squad script, i'll give it to JV to see if it's usable in bots.

i put that into the unnamedsolider.cfg at the end, but now it just says Grenade take cover, and switches my gun. doesn't even try to shoot :S
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

It won't be usable in bots as you cannot get cvars from players, only the server.

Try this:

Code: Select all

alias codnade "locationprint 275 100 THROWING 0; useweaponclass grenade; wait; wait; wait; +attackprimary; wait; wait; wait; -attackprimary; say *35; +uselast"
The + in front of a command makes it being executed when a button is pressed. The - command is executed when the button is released. E.g. when you press your fire, +attackprimary is done. When you release it, -attackprimary is done.
Wait takes miliseconds as parameters. Giving it a paramter of .6 if quite pointless.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply