Scripts

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

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

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

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

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

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.
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

Tue May 05, 2009 7:15 am

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

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)
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

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 ;)
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

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

Wed May 06, 2009 3:31 pm

  • Is there a possibility to add such features in the next version of Nexuiz?
    Waterlaz
    Member
     
    Posts: 40
    Joined: Sun Feb 22, 2009 11:10 am

Wed May 06, 2009 11:46 pm

  • You could set the "log_file" variable, have an external program monitor the file while updating a cfg file with a bunch of variables upon seeing certain strings, continuously (with "defer") exec the cfg file from within Nexuiz and use the variables in your aliases/binds. It'll work (I've tested it with a crude shell script), but the console will be spammed with "execing xyz.cfg" and there will be noticeable delay between events and variable values. And it's so convoluted that it's funny; I certainly hope there's a better way to achieve the same thing.
    User avatar
    parasti
    Alien
     
    Posts: 110
    Joined: Sun May 11, 2008 11:32 pm
    Location: On the walls and the ceiling

Thu May 07, 2009 12:52 am

  • Heh... I've thought about that. But won't this be considered cheating in some way?
    I personaly think it's ok. But somebody might not like it.
    Waterlaz
    Member
     
    Posts: 40
    Joined: Sun Feb 22, 2009 11:10 am



Return to Nexuiz - General Discussion




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest