Jump to content

Home

trying to write script, and need help.(NOT cheat)


SPY_jmr1

Recommended Posts

ok I am trying to not write a script, but modify one. I want to be able to cycle thrugh the saber colors in mp.

 

okok I found this :

 

// Rail Rainbow

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

set rail0 "color 0; set rrail vstr rail1"

set rail1 "color 1; set rrail vstr rail2"

set rail2 "color 2; set rrail vstr rail3"

set rail3 "color 3; set rrail vstr rail4"

set rail4 "color 4; set rrail vstr rail5"

set rail5 "color 5; set rrail vstr rail6"

set rail6 "color 6; set rrail vstr rail0"

vstr rail0

set rrail vstr rail0

bind x "weapon 7; vstr rrail"

 

its for the same thing for railgun in Q3.

 

 

// Saber Rainbow

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

set saber0 "color 0; set sabcolor vstr saber1"

set saber1 "color 1; set sabcolor vstr saber2"

set saber2 "color 2; set sabcolor vstr saber3"

set saber3 "color 3; set sabcolor vstr saber4"

set saber4 "color 4; set sabcolor vstr saber5"

set saber5 "color 5; set sabcolor vstr saber6"

set saber6 "color 6; set sabcolor vstr saber0"

vstr color0

set color vstr saber0

bind x "weapon 1; vstr color"

 

now i know that this cannot be right, cos the command is 'color1 X'

 

what i need help with is what does what in the syntax up there...

 

somebody who knows something about this and can help would be very nice.

 

TIA

 

SPY.

Link to comment
Share on other sites

hmm after i posted this, i found what i was looking for... ftp://newcollective.org/pub/jk2files/sabercycle.zip

 

heres the code :

//Cycle saber colors: Press l

set saberred "color1 0; bind l vstr saberorange"

set saberorange "color1 1; bind l vstr saberyellow"

set saberyellow "color1 2; bind l vstr sabergreen"

set sabergreen "color1 3; bind l vstr saberblue"

set saberblue "color1 4; bind l vstr saberpurple"

set saberpurple "color1 5; bind l vstr saberred"

bind l vstr saberred

 

hmm not so far off after all.

 

still looking for someone to explain this all.

Link to comment
Share on other sites

I use the following commands added to autoexec.cfg

 

bind c "vstr colorRE"

set colorRE "color1 0;bind c vstr colorOR"

set colorOR "color1 1;bind c vstr colorYE"

set colorYE "color1 2;bind c vstr colorGR"

set colorGR "color1 3;bind c vstr colorBL"

set colorBL "color1 4;bind c vstr colorPU"

set colorPU "color1 5;bind c vstr colorRE"

 

Very Similar to what you posted above.

 

The set command creates a new "variable" equal to whatever is in the quotes. So after the above commands are run, the variable colorRE equals "color1 0;bind c vstr colorOR"

 

The vstr command tells the engine to execute the contents of the variable as a command.

 

The RailGun config in your original post was changing a variable at each press rather than changing the binding.

 

autoexec.cfg if it exists is executed at startup for both single player and multiplayer. Commands in autoexec.cfg should be entered just as you'd type them into the console. (don't prefix with seta) Also some commands don't work until your actually in an active game so those commands won't work in autoexec.cfg.

 

An easy way to change your config on the fly once a game is loaded is to bind a key to execute your custom config(s).

You can create a config file called anyname.cfg and bind a key to run it "bind x exec anyname.cfg"

I have several configs I can cycle through depending on the type of map, type of game etc...

Link to comment
Share on other sites

hmm thanks alot dude.

 

looks like the 2nd one i posted should have worked, but it would not no matter what i tryed.

 

maybe trying it at 2 am was not a good idea:D

 

edit: looking at both of them, the only change is your bind is at the top of the script, and one set of quotes.

 

do the quotes matter that much?(with my luck they do... ;))

Link to comment
Share on other sites

The quotes are helpful when you have more than 1 action set to a variable. For example,

 

bind k +kill

that is acceptable, but for more than 1 action like:

bind k "+kill; +attack"

I would probably put in quotes

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...