Complete NEWBIE can't even get simple script to exec
Moderator: Moderators
Complete NEWBIE can't even get simple script to exec
Hello...Newbie Here.
I am trying to develop my own script to set some cvars and I'm suckin wind here. My first goal is to create a script that I can get to in the game. I've read the scripting tutorial and I'm trying to exec a method or start a thread. I picked a nonstock multiplayer objective map and exploded it. In the maps/obj/[MAPNAME].scr file I created my own little method that looked like this:
test:
println "Hello"
setcvar "g_obj_alliedtext3" "Test to see if I can change variable"
end
in the main after level waittil spawn, I put this "exec test". I zipped the folder backup and rename it to the original .pk3. So, working off one computer, I start a new multiplayer game, pick the map that I've been tweaking. I don't see a "Hello" on the screen. I check the objective page and don't see my text under alliedtext3. I have tried "exec test" and ?thread test?. No screen message or changed alliedtext3.
Then, I copied the text and put it in the main of maps/obj/[MAPNAME].scr (deleted the test: and end) to see if it would exec straight from the main. No luck there either?Man I suck at this!!!
Once I get smart enough to find my a$$ here, I hope to create a separate .pk3 with a global folder that contains nothing but my custom scripts. However, I can't even get off the ground executing my scripts from within the {MAPNAME].scr file.
What am I missing?
I am trying to develop my own script to set some cvars and I'm suckin wind here. My first goal is to create a script that I can get to in the game. I've read the scripting tutorial and I'm trying to exec a method or start a thread. I picked a nonstock multiplayer objective map and exploded it. In the maps/obj/[MAPNAME].scr file I created my own little method that looked like this:
test:
println "Hello"
setcvar "g_obj_alliedtext3" "Test to see if I can change variable"
end
in the main after level waittil spawn, I put this "exec test". I zipped the folder backup and rename it to the original .pk3. So, working off one computer, I start a new multiplayer game, pick the map that I've been tweaking. I don't see a "Hello" on the screen. I check the objective page and don't see my text under alliedtext3. I have tried "exec test" and ?thread test?. No screen message or changed alliedtext3.
Then, I copied the text and put it in the main of maps/obj/[MAPNAME].scr (deleted the test: and end) to see if it would exec straight from the main. No luck there either?Man I suck at this!!!
Once I get smart enough to find my a$$ here, I hope to create a separate .pk3 with a global folder that contains nothing but my custom scripts. However, I can't even get off the ground executing my scripts from within the {MAPNAME].scr file.
What am I missing?
i may be wrong but i think those cvars are only sent to clients once, so even if you change them during the game they wont appear to.
there's some rather technical problems with this, though
MOH checks for the script you exec. first: in the folder that the map is in (for obj maps it's maps/obj) or, if you specify a path (such as global/test.scr) it looks from the main folder to there (the game checks in main/global/test.scr) and i believe MOH does require you to add an extension to the command (test.scr).
so all in all, here's the command. (if your file is in the same folder as your map)
now if you wanted to put your handy scripts all in one folder, separate from the rest, you can jsut do this;
put them in the folder
and change the exec command!
so say you put them in a folder called "commands"
and of course you can bind keys with this command or make aliases or whatever you wish, it doesnt have to be in script.
i'm sorry if this didn't come out clear, still a little disoriented from the 4th of july celebrations 
there's some rather technical problems with this, though
MOH checks for the script you exec. first: in the folder that the map is in (for obj maps it's maps/obj) or, if you specify a path (such as global/test.scr) it looks from the main folder to there (the game checks in main/global/test.scr) and i believe MOH does require you to add an extension to the command (test.scr).
so all in all, here's the command. (if your file is in the same folder as your map)
Code: Select all
exec test.scrput them in the folder
and change the exec command!
so say you put them in a folder called "commands"
Code: Select all
exec commands/test.scrCode: Select all
alias changeScores exec commands/test.scr
bind x changeScores
// or
bind x exec commands/test.scrModerator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
Hi netdawg.
I'm not sure what you're doing with the pk3s.. just save the .scr file in the right folder (main\maps\obj\mapname.scr) and it'll have precedence over any file in any pk3. So that's the quick way
. Work like that until you have something to distribute
I'm not sure what you're doing with the pk3s.. just save the .scr file in the right folder (main\maps\obj\mapname.scr) and it'll have precedence over any file in any pk3. So that's the quick way
Reasonable guess, but nope, they'll updatelizardkid wrote:i may be wrong but i think those cvars are only sent to clients once, so even if you change them during the game they wont appear to.
This bit is definately not true.. you posted bits of a cfg file which is merely a collection of console commands and completely different from a script. A cfg file runs on the client whereas a script (.scr) runs on the server. The console 'exec' command and the script 'exec' command are entirely different and should not be confused. As far as I know, it is not possible to run a script directly via a console command.lizardkid wrote:and of course you can bind keys with this command or make aliases or whatever you wish, it doesnt have to be in script.
not true jv, i have many files saved in main>commands that are .scr files that i have binds to that do things ingame for me. such as auto-join teams and pick weapons and turn on debug features. they dont manipulate entities or anything, but they stuff commands to console for me.
if the server was told in console (or rcon) to exec a script on objects and such i dont think it'd do it, but if they are basic commands such as cvar settings then yes, it'll perform them.
for what you need netdawg, you could jsut store in the server's main folder and rcon exec them. as long as you dont change anything you cant inside the console. (so you're limited to setting cvars and such)
if the server was told in console (or rcon) to exec a script on objects and such i dont think it'd do it, but if they are basic commands such as cvar settings then yes, it'll perform them.
for what you need netdawg, you could jsut store in the server's main folder and rcon exec them. as long as you dont change anything you cant inside the console. (so you're limited to setting cvars and such)
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
Thanks...I'm still working on it
Hello All...It's good for me to read the discussion here. Basically, I've been sucking wind pretty badly and your advise helps. In the end, I'd like to create a script to better assemble teams based on nonstock maps. I haven't been able to get off the ground. So, I've been trying to create a method or a thread and see that it get's executed. Once I know the method is being triggered, then I'll start adding more complexity. I was playing with allied text, just because it was something that was easy to change...and by pressing the tab key, I was easily able to see that I did something with my method. I did have a little success while using notepad via console. I created a method and added an exec in the main. When I restarted the map, it seemed to work. I noticed that the .scr file was not a part of the .pk3 tree. So, I got bold and replaced the original .scr file with my modified one. Then, zipped it back up and executed....it bombed.
Really, I don't care where the .scr is and I don't care if .scr is not a part of the .pk3 tree. The scripts I hope to create should all be server side. I don't care if it's not a zipped up, renamed .pk3, just so it functions the way I designed.
Rather than trying to build the whole script, put it in place, and debug the whole thing. I'm trying to start with basic things and add complexity. Thanks for telling me that I don't have to make the .scr part of the .pk3. It was taking forever to zip up, rename, move files, and restart the game just to test a line or two of my script. It is very appealing to me to have a way to call the method from within the game. I've been putting the call to my method after level spawn but before roundstart. Then, I unload the map and reload it with rcon **** map [mapname]. What's the best way to test the method in the game....when I try exec test.scr, I usually get something like can't find end....I think it's trying to exec a .cfg file rather than the .scr. Can you key bind to a method? If so, where does the alias go....in the config file?
I've done some programming before, but in this case...I just don't quite get the IDE.
Thanks for the help....you're saving me time...I appreciate your efforts. Hopefully one day I won't be such a noob.
Really, I don't care where the .scr is and I don't care if .scr is not a part of the .pk3 tree. The scripts I hope to create should all be server side. I don't care if it's not a zipped up, renamed .pk3, just so it functions the way I designed.
Rather than trying to build the whole script, put it in place, and debug the whole thing. I'm trying to start with basic things and add complexity. Thanks for telling me that I don't have to make the .scr part of the .pk3. It was taking forever to zip up, rename, move files, and restart the game just to test a line or two of my script. It is very appealing to me to have a way to call the method from within the game. I've been putting the call to my method after level spawn but before roundstart. Then, I unload the map and reload it with rcon **** map [mapname]. What's the best way to test the method in the game....when I try exec test.scr, I usually get something like can't find end....I think it's trying to exec a .cfg file rather than the .scr. Can you key bind to a method? If so, where does the alias go....in the config file?
I've done some programming before, but in this case...I just don't quite get the IDE.
Thanks for the help....you're saving me time...I appreciate your efforts. Hopefully one day I won't be such a noob.
thats true however for anything you can put into console, like jv said, you can make .scr or .cfg files and just list the commands you want to execute and call that. simple cvar changing (for instance my clan once had a cfg on the server detailing match settings and different common scrim settings) or clientside changes that's (i feel) the only way to go.
but that has the downfall of not being able to do tests, so autobalancing teams is out, as is ping kicking and such.
programs like Counter Intelligence use actual programs to do this sort of thing, they monitor the game and manipulate console commands from there.
anything else would probably degrade latency too much to be worth it.
but that has the downfall of not being able to do tests, so autobalancing teams is out, as is ping kicking and such.
programs like Counter Intelligence use actual programs to do this sort of thing, they monitor the game and manipulate console commands from there.
anything else would probably degrade latency too much to be worth it.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
edit script
You can edit the main map script right in the game. I think you need to be in developer mode, but you only need to type "editscript" in the console to bring up a notepad like screen. It's not a great editor but, when you figure out how to use it, it will save a lot of time.
Another Question...Same Topic
Hello Again...I'm making good progress here thanks to your help. Let me ask what i hope is a simple question....
In a server side script, I'm looking to find the player's screen name....you know the name the player enters in MP game under MP options. I've been looking through the gallclasses.html that comes with Radiant, but the closest thing I can find is actorinfo in the player's class. I figure it has to be something like $player[num].name, but I don't have a clue. Can you help the newbie out?
In a server side script, I'm looking to find the player's screen name....you know the name the player enters in MP game under MP options. I've been looking through the gallclasses.html that comes with Radiant, but the closest thing I can find is actorinfo in the player's class. I figure it has to be something like $player[num].name, but I don't have a clue. Can you help the newbie out?
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:



