cvar question..
Moderator: Moderators
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
cvar question..
someone knows if there's a cvar "nextmap"?
I need to make a getcvar to results the name of the next map of map list..
I need to make a getcvar to results the name of the next map of map list..
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Yes the cvar "nextmap" holds the mapname of the next map. But it is not used on servers so it is actually useless to you.
Why do you need it anyways? There are a lot of "Next map" displaying scripts.
If you don't want to display it and only want the name then use this:
Why do you need it anyways? There are a lot of "Next map" displaying scripts.
If you don't want to display it and only want the name then use this:
Code: Select all
//**********************************************
// get the name of the next map in line
//**********************************************
get_nextmap:
local.maplist = (getcvar "sv_maplist")
local.map = waitthread split_line local.maplist 1 " "
local.mapscript = waitthread to_lower (getcvar "mapname")
for (local.i = 1; local.i <= local.map[1].size; local.i++)
{
if (local.map[1][local.i] == local.mapscript)
{
local.f = (local.i + 1)
if (local.f > local.map[1].size)
{
local.f = 1
}
local.match = 1
local.nextmap = local.map[1][local.f]
end local.nextmap
}
}
if (local.match != 1)
{
end NIL
}
end
// The next two threads are
// from Elgan's strings.scr
// ---------------------------------------------------------------------------------
// Used to split a line of words into a array of words. return with word count
// localinfo == line to split
// local.say = say to admins input detected or not, set 1 usualy
// local.spacer = What to use to split the line. If none is set then " " will be used.
// usage local.wordarray = waitexec global/strings.scr::split_line ( STRING STRING, FEEDBACK, STRING SPACER)
//
//eg
// local.wordarray = waitexec global/strings.scr::split_line "hello_mummy" 1 "_"
// local.wordarray is a const array
//
// local.wordarray[1] = array of words
// local.wordarray[2] word count
// local.wordarray[3] full string with " " spaces
//
// local.wordarray[1][1] is 'hello'
// local.wordarray[1][1] is 'mummy'
//
// local.wordarray[2] is 2 'two words'
//
// local.wordarray[3] is 'hello mummy'
// ---------------------------------------------------------------------------------
split_line local.info local.dont_say local.spacer:
local.wordcount = 1
if(local.spacer==NIL)
{
if(local.info[0] == "`")
{
local.spacer = "_"
local.start = 1
}
else if(local.info[0] == " " || local.info[0] == "")
{
local.spacer = " "
for(local.i = 0;local.i <= local.info.size;local.i++)
{
if(local.info[local.i] != " " && local.info[local.i] != "")
{
local.start = local.i
break
}
}
}
else
{
local.spacer = " "
local.start = 0
}
}
else
{
local.start = 0
local.altcheck = 1
}
for(local.i=local.start;local.i<=local.info.size - 1;local.i++)
{
if(local.info[local.i]!=local.spacer && local.info[local.i] != "`")
{
if(local.words[local.wordcount]==NIL)
{
local.words[local.wordcount]=""
}
local.words[local.wordcount] += local.info[local.i]
}
else
{
if(local.altcheck != 1)
{
if(local.spacer == "_" && local.info[local.i + 1] == "`")
{
local.words[local.wordcount] += local.info[local.i]
}
else if(local.spacer == "_" && local.info[local.i ] != "`")
{
local.wordcount++
}
else if(local.spacer == " " && local.info[local.i ] == " ")
{
if(local.i != local.info.size - 1)
{
if(local.info[local.i + 1] != " " && local.info[local.i + 1] != NIL)
{
local.wordcount++
}
}
}
}
else
{
if(local.info[local.i ] == local.spacer)
{
local.wordcount++
}
}
}
}
if(local.spacer == "_")
{
local.actual = ""
for(local.i=3;local.i<=local.words.size;local.i++)
{
if(local.i < local.words.size)
{
local.space = " "
}
else
{
local.space = ""
}
local.actual += ( local.words[local.i] + local.space )
}
if(local.dont_say != 1)
{
//exec global/ac/console_feedback.scr ( "> Input detected: " + local.actual )
}
}
else
{
if(local.dont_say != 1)
{
//exec global/ac/console_feedback.scr ( "> Input detected: " + local.info)
local.actual = local.info
}
}
end ( local.words::local.wordcount::local.actual)
// --------------------------------------------------------------------------
// to_lower
// This will convert a given string to lower case
// usage local.string = waitexec global/strings.scr::to_lower (STRING STRING, INDEX TO CONVERT)
// Result: a lower case string
//
//eg
// local.string = waitexec global/strings.scr::to_lower "HELLO"
// local.string will become 'hello'
//eg2
// local.string = waitexec global/strings.scr::to_lower "HELLO" 0
// local.string will become 'hELLO'
// --------------------------------------------------------------------------
to_lower local.string local.index:
local.lower = waitthread chardata_lowercase
local.upper = waitthread chardata_uppercase
for(local.i = 0; local.i <= local.string.size - 1; local.i++)
{
local.letter = local.string[local.i]
if(local.i == local.index || local.index == NIL)
{
for(local.t = 1; local.t <= local.upper.size; local.t++)
{
if(local.letter == local.upper[local.t])
{
local.letter = local.lower[local.t]
local.string[local.i] = local.letter
}
}
}
else
{
local.string[local.i] = local.letter
}
}
end local.stringOur official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
I'm trying to make the malta map select different scr to run differtents mods..
for exemple...if next map is stalingrad the map will run mp_malta_dm1.scr
and if the next map is mohdm2 it will run mp_malta_dm2.scr .
that's all..
I've put a script before prespown that select differents malta scr...but i'm having problems..
for exemple...if next map is stalingrad the map will run mp_malta_dm1.scr
and if the next map is mohdm2 it will run mp_malta_dm2.scr .
that's all..
I've put a script before prespown that select differents malta scr...but i'm having problems..
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Well just place what I posted above in a seperate script or in your malta script and the result will be the nextmap. Like so:
or (if you placed it in your malta script)
Then local.o will contain the string of the next map.
Code: Select all
local.o = waitthread global/a_script.scr::get_nextmapCode: Select all
local.o = waitthread get_nextmapOur official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
I have to insert a new keyboard 's key to active a thread when pressed...
in this case I've used keys O and L for an exemple..but I bunno what to put in ()....I had a look at all classies list but most of them are unknown to me..I'm still a newbie...lol
advices??
Code: Select all
someting like that:
if (O){
thread thread1
}
if (L){
thread thread2
}advices??
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
It is quite impossible to detect when a key is pressed. Besides, you cannot execute any scripts in a server you don't host (I can't imagine what would happen if that was possible). If you do host the server yourself, you can do this through cvar input in the console.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Run this thread first:
Then use in the console:
mycvar thread1
or
mycvar thread2
Change the mycvar to anything you want, but edit all instances of it in that lil' script.
Code: Select all
sth:
setcvar "mycvar" ""
while(1)
{
if ( (getcvar "mycvar") != "")
{
local.t = (getcvar "mycvar")
setcvar "mycvar" ""
thread local.t
}
wait 0.3
}
end
mycvar thread1
or
mycvar thread2
Change the mycvar to anything you want, but edit all instances of it in that lil' script.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
hummmm..I still don't understead...using this one i set a cvar, but the problem is the cvar itself..I'm looking at cvar list but I don't understeand what to do..
how can I use cvars to set the use of a key such as "A", "B", ecc...?!
there should be an already existent one that set the use of a certain key....something like that:
man...I don't really understeand how cvars works.... 
also I've founded these 2: ..i never used them..maybe these can be useful to me...
how can I use cvars to set the use of a key such as "A", "B", ecc...?!
there should be an already existent one that set the use of a certain key....something like that:
Code: Select all
setcvar "used key" "A"also I've founded these 2: ..i never used them..maybe these can be useful to me...
Code: Select all
getboundkey1( String keyname )
return a string describing the key
getboundkey2( String keyname )
return a string describing the key-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
You shouldn't be looking in the cvar list because:hummmm..I still don't understead...using this one i set a cvar, but the problem is the cvar itself..I'm looking at cvar list but I don't understeand what to do..
1. They are internal and are handled by the engine. You cannot change them to your will.
2. They cannot detect anything
3. None of them are any help to you
4. They just contain data in the form of strings
That's why I made a new cvar and a script which handles it like you want it to.
You mean the keybinds? Well, why don't you try it hehethere should be an already existent one that set the use of a certain key....something like that:
I'm sure that'll work!
Go to main/configs/unnamedsoldier.cfg and add something like this:
Code: Select all
bind e "exec global/myscript.scr"getboundkey1 and getboundkey2 are used to return the string of the key binded to the specified action. In other words, not to detect when a key is pressed. Besides, it only works properly in SP. Since it only checks the host/server binds. They can return "Enter" or "f" for "+use". Completely irrelevant to you.also I've founded these 2: ..i never used them..maybe these can be useful to me...
I already explained how to use it in my previous post.man...I don't really understeand how cvars works....
Make sure that script is running and located in the mapscript of your map and enter this is the console: "mycvar mythread". Where "mycvar" is the cvar handled in the script I posted earlier and "mythread" the name of the thread you want to activate.
I already gave you the perfect solution to your problem. Did you even bother to try it??
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Well I get annoyed when my efforts in helping people get ignored. It's only natural.
So the keybind text was sarcastic, if that way had worked then I would have suggested it.
But I can make my solution even fancier by letting him pass variables through the console to the thread he wants to activate.
So the keybind text was sarcastic, if that way had worked then I would have suggested it.
But I can make my solution even fancier by letting him pass variables through the console to the thread he wants to activate.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
SilentAngel
- Captain
- Posts: 239
- Joined: Wed Mar 12, 2008 8:27 pm

