Tremulous Forum

Mods => Modding Center => Topic started by: Pbhead on November 14, 2008, 03:26:52 pm

Title: a few map rotation questions
Post by: Pbhead on November 14, 2008, 03:26:52 pm
hey,


I am trying to learn how to make my own maprotation.cfg file,  anyway, i want to make a rotation that changes depending on what the server is up to...

So, what i need is some way to know how many players are on the server, and also who won last game... Basicly... how can I call this infomation from somewhere else so I can use it.

Second, can I use arrays in my maprotation file... or at least can I create my own varibles in maprotation.cfg that will be stored so that i can use them again a while later.

I am trying to grasp as much as i can, but its hard to find info on exactly how to do these sorts of things, and the standard maprotation files are preety bland, and so I cant get any knowlege off of it.


Thanks for your help.
Title: Re: a few map rotation questions
Post by: David on November 14, 2008, 03:46:45 pm
This is just about the only question where "RTFM" is a good answer.  Linky: http://tremulous.net/manual/#x1-150003.4

number of clients is there, as is who won last.  And that's all there is.
Title: Re: a few map rotation questions
Post by: Pbhead on November 14, 2008, 04:15:34 pm
dam it... I was looking everywhere trying to find something like that...  i guess google isnt perfect. heh. thanks.


erm... still missing a few things though... how would I define say.... a counter like "i" that is persistant, and... what is the word for "if lastWin (draw, or timelimit hit or whatever)" --figured a way around this... Still need the process to define counters.
Title: Re: a few map rotation questions
Post by: kevlarman on November 14, 2008, 05:53:33 pm
you can't, maprotation.cfg is already very complex (it eats 17mb of memory just by itself), and adding things like counters is extremely non-trivial because the memory doesn't persist through mapchanges.
Title: Re: a few map rotation questions
Post by: Pbhead on November 14, 2008, 06:32:58 pm
hmm... well... can I put my counters somewhere else... like... in a different file, and then call them from there?

so... if somewhere else (any ideas where? heh...), i made a counter called g_counter, then could i use this?:

Code: [Select]
mapRotation1
{

if g_counter = 1

(map 1)

{

set g_counter 2

goto mapRotation1

}

if g_counter = 2

(map 2)

{

set g_counter = 3

goto mapRotation1
}

if g_counter = 3

(map 3)

{

set g_counter = 1

goto mapRotation1
}

}



Now, i know that that code may seem silly, and overcomplicated, since i could do the exact same thing alot simpler, but would it work?
Title: Re: a few map rotation questions
Post by: David on November 14, 2008, 07:08:00 pm
ATM there is no support for anything like that, although you could probably add cvar's and exec without too much insane difficulty.
Title: Re: a few map rotation questions
Post by: kevlarman on November 14, 2008, 08:16:32 pm
Now, i know that that code may seem silly, and overcomplicated, since i could do the exact same thing alot simpler, but would it work?
no it won't (and be careful with conditional and even unconditional jumps, too many of them and the game will crash)
Title: Re: a few map rotation questions
Post by: Pbhead on November 15, 2008, 03:30:39 am
Now, i know that that code may seem silly, and overcomplicated, since i could do the exact same thing alot simpler, but would it work?
no it won't (and be careful with conditional and even unconditional jumps, too many of them and the game will crash)

why not? what am i missing? is it a simple syntax error, or is it something more serious...

I know you can use "set" to set ingame things, like g_speed and g_gravity and shizz... so why cant i create my own thing that is useless as far as the game is conserned, but i can use "set" on it and then use "if".....  or is that the problem... can "if" only do very certain things...

SO, is that the problem, "if" can only be used on numClients and lastWin and random?  ok... so I need to expand the ablities of "if"... now how am i supposed to do that... hmmm.... 


SO... the new point of this thread... how do I change the "if" command so i can use it to do other things besides the things its programed to do?  (oh, why couldnt they just program the file in C instead of creating... effectively their own... program that reads the text file...)
Title: Re: a few map rotation questions
Post by: kevlarman on November 15, 2008, 06:12:28 am
SO, is that the problem, "if" can only be used on numClients and lastWin and random?  ok... so I need to expand the ablities of "if"... now how am i supposed to do that... hmmm.... 
correct
Quote
SO... the new point of this thread... how do I change the "if" command so i can use it to do other things besides the things its programed to do?  (oh, why couldnt they just program the file in C instead of creating... effectively their own... program that reads the text file...)
because maprotation.cfg should be understandable to people other than programmers, and because writing what is effectively a C interpreter from scratch isn't exactly easy (for something 95% of people won't use), and because the structure that is created from maprotation.cfg already eats 17MB out of the ~100-150MB that a server uses.
Title: Re: a few map rotation questions
Post by: Archangel on November 15, 2008, 05:12:57 pm
why so bloated, kevlarman?
Title: Re: a few map rotation questions
Post by: Amanieu on November 15, 2008, 05:31:06 pm
Because the guy who wrote the map rotation system ran out of coffee