Scripts

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

Scripts

Postby Waterlaz » Tue May 05, 2009 12:30 am

Is there a doc about scripting? What I can do and what can't?
I know the basic alias and bind stuff but very limited.
I've heard somewhere that the scripts are turing complete so I have these questions:
1) Is there a loop (can do without it but just curious)?
2) Can I make a function (similar to alias but to return a value. )?
3) Is there an "if" operator or "if" function? (can't do without at least one of them I guess =( )
4) Is there a way to tell wether I have the flag or don't?
Waterlaz
Member
 
Posts: 40
Joined: Sun Feb 22, 2009 11:10 am

Postby Waterlaz » Tue May 05, 2009 12:56 am

never min4 the 1-3. Lurked it =)
But what about 4?
Waterlaz
Member
 
Posts: 40
Joined: Sun Feb 22, 2009 11:10 am

Postby Komier » Tue May 05, 2009 1:26 am

There is a picture of flag carriers at the bottom of the screen I believe. When you have the flag, it's a different picture, like a picture of the head of the guy (?) instead of the whole body.

Am I just totally wrong? :D
Every government interference in the economy consists of giving an unearned benefit, extorted by force, to some men at the expense of others. -Ayn Rand
Komier
Advanced member
 
Posts: 79
Joined: Fri Sep 28, 2007 2:24 am
Location: USA

Postby Waterlaz » Tue May 05, 2009 1:34 am

No. I mean from the script. My script has to know if I havethe flag or not.
Waterlaz
Member
 
Posts: 40
Joined: Sun Feb 22, 2009 11:10 am

Re: Scripts

Postby mand1nga » Tue May 05, 2009 6:58 am

1) Is there a loop (can do without it but just curious)?

No, but you can do something like this

Code: Select all
alias foo "command 1; command 2; defer 20 foo;"


This way whenever you call the alias foo it will keep executing itself every 20 seconds. Note that the defer 20 command is optional. The only way to stop it is redefining or deleting the alias.


2) Can I make a function (similar to alias but to return a value. )?
3) Is there an "if" operator or "if" function? (can't do without at least one of them I guess =( )


Try with the command menu_cmd. It is a little obscure, but you can use it for some basic operations.

4) Is there a way to tell wether I have the flag or don't?

No that I'm aware of

Good luck :)
Last edited by mand1nga on Tue May 05, 2009 2:02 pm, edited 1 time in total.
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby [-z-] » Tue May 05, 2009 7:15 am

[-z-]
Site Admin and Nexuiz Ninja
 
Posts: 1794
Joined: Mon Nov 13, 2006 12:20 am
Location: Florida

Postby Waterlaz » Tue May 05, 2009 10:09 am

Yeah.... thanks. But I would realy like to know this flag info. Too bad =(.
Waterlaz
Member
 
Posts: 40
Joined: Sun Feb 22, 2009 11:10 am

Re: Scripts

Postby terencehill » Tue May 05, 2009 12:31 pm

mand1nga wrote:
Code: Select all
alias foo "command 1; command 2; defer 20; foo;"


There is a wrong ; after defer 20


More complex things like if, real loops, for, string comparison, etc... here u can find a very useful script that allow u to use them (actually is an extension of the console scripting language)
terencehill
Alien
 
Posts: 176
Joined: Thu Jul 10, 2008 10:33 pm
Location: Italy

Postby mand1nga » Tue May 05, 2009 2:10 pm

Waterlaz wrote:Yeah.... thanks. But I would realy like to know this flag info. Too bad =(.


Why not enable a cvar telling that you have the flag with a bind? I mean something like this:

Code: Select all
set ihavetehflag 0
bind key "toggle ihavetehflag 1 0"


That should do the trick, and you won't lose too many milliseconds of that run while pressing this key ;)
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby Waterlaz » Tue May 05, 2009 2:23 pm

Yes. But I would have to learn another bind(too much of them already) =).

This kind of info can be found in console log.
I've found the command to clean log and to write the log to a file.
Is there a way to read from file? Is there a way to write your own stuff to some file?
Waterlaz
Member
 
Posts: 40
Joined: Sun Feb 22, 2009 11:10 am

Next

Return to Nexuiz - General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron