Scripting Problems
Moderators: jelco, bert_the_turtle
Scripting Problems
I can't get any text on the objectives, or text. It says 'ERROR (cityoflifeobj2)', instead of what the objective is suppose to say. It seems to do everything else tho.
Re: Scripting Problems
Cotcan wrote:I can't get any text on the objectives, or text. It says 'ERROR (cityoflifeobj2)', instead of what the objective is suppose to say. It seems to do everything else tho.
Given that you haven't really explained exactly what your problem is, I am going to make a series of assumptions. First, I am going to assume that you have not configured your mission file properly. At the bottom of the mission file, there should be a block that looks like this:
Code: Select all
PrimaryObjectives_StartDefinition
BuildingOnline :annihilation,1 annihilation_objAa annihilation_objA.txt
BuildingOnline :annihilation,2 annihilation_objAb annihilation_objA.txt
BuildingOnline :annihilation,51 annihilation_objB annihilation_objB.txt
PrimaryObjectives_EndDefinition
The above code block contains three mission objectives. Each objective consists of three parts: a trigger, a tag for an object in strings_default.txt, and a script file. The trigger describes what needs to happen in order for the objective to be complete. So, for instance, the first objective is completed when building 1 in the level annihilation comes online. The tag (and I think this is what you are having trouble with) refers to a specific line in strings_default.txt that will be displayed on the objectives screen in the game. If, for instance, the following block of text is in strings_default.txt,
Code: Select all
annihilation_objAa Activate the Trunkport to Primary_Core, or...
annihilation_objAb Activate the Trunkport to Backdoor
annihilation_objA_1 ...If I activate the trunkport to Primary_Core, completion of Dr. Greenbrae's project should be trivial, but I will not have the opportunity to hear what Dr. Sepulveda has to say...
annihilation_objA_2 ...However, if I activate the trunkport to Backdoor and hear Dr. Sepulveda out, it is possible that he will sabotage the trunkport, making it impossible to capture Primary_Core...then the objectives screen of that level will look like this:
The last bit of the objective is optional -- it is the name of a script file that will be run when the player clicks on the objective.
So, the error that the game is throwing is telling me that Darwinia is looking for a line in strings_default.txt tagged "cityoflifeobj2", but that it cannot find that line. The first thing that I would do is to make sure that the tag "cityoflifeobj2" is actually present in the file strings_default.txt.
xander
I alrighty know how to do a objective.
Here I'll show you those parts:
I've alrighty read the guide, both of them.
Here I'll show you those parts:
Code: Select all
PrimaryObjectives_StartDefinition
BuildingOnline :cityoflife,0 objective_capture_trunk
BuildingOnline :cityoflife,110 cityoflifeobj2 cityoflife_obj2.txt
PrimaryObjectives_EndDefinitionCode: Select all
CamBuildingFocus 110 300 300
Highlight 110
Say cityoflifeobj2_1
WaitSay
ClearHighlights
CamReset
Code: Select all
cityoflifeobj2 We need 3000 darwins
cityoflifeobj2_1 We will need 3000 darwins in the city to hold off the virus.
I've alrighty read the guide, both of them.
Cotcan wrote:I alrighty know how to do a objective.
You posted one sentence above. From that, I was supposed to assume that you had any idea what you were doing? If you don't want me to run over the basics, show me that you know them. Otherwise, I am forced to assume that you do not, and start from scratch.
Cotcan wrote:Here I'll show you those parts:Code: Select all
PrimaryObjectives_StartDefinition
BuildingOnline :cityoflife,0 objective_capture_trunk
BuildingOnline :cityoflife,110 cityoflifeobj2 cityoflife_obj2.txt
PrimaryObjectives_EndDefinitionCode: Select all
CamBuildingFocus 110 300 300
Highlight 110
Say cityoflifeobj2_1
WaitSay
ClearHighlights
CamResetCode: Select all
cityoflifeobj2 We need 3000 darwins
cityoflifeobj2_1 We will need 3000 darwins in the city to hold off the virus.
I've alrighty read the guide, both of them.
Can I assume that the other objectives are displayed properly, or should I assume otherwise? Should I assume that you have already tried to quit Darwinia and restart it? Because strings_default.txt is only loaded when you start Darwinia. You seemed to indicate that your scripts are running properly, including text. Is that the case? Is it safe to assume that there is a blank line at the end of strings_default.txt. Otherwise, your scripting looks right, from what you have posted.
Also, just a note, it is spelt "Darwinian," not "Darwin," unless that was an intentional change.
xander
I'll add one more thing to what xander has outlined for you. You haven't said which OS you are using, and there are some filename gotchas that might cause your problem.
Both linux and OSX are case sensitive, while WinXP (and Vista?) are not. If you are on a non-windows system you MUST always use lowercase for your filenames, or darwinia won't find them. So it's strings_default.txt, not Strings_Default.txt, and any subdirs under the mod dir must also be lowercased.
Likewise, it's fine for your ScriptTriger to specify "MyScript.txt" under any OS... but darwinia will automatically look for "myscript.txt" under all OSes. So all files MUST always be lowercase (especially if you expect portability), unless you use Windows, in which case the OS will find the file either way.
In the future, please try to explain your problem a little better. Details please!
Both linux and OSX are case sensitive, while WinXP (and Vista?) are not. If you are on a non-windows system you MUST always use lowercase for your filenames, or darwinia won't find them. So it's strings_default.txt, not Strings_Default.txt, and any subdirs under the mod dir must also be lowercased.
Likewise, it's fine for your ScriptTriger to specify "MyScript.txt" under any OS... but darwinia will automatically look for "myscript.txt" under all OSes. So all files MUST always be lowercase (especially if you expect portability), unless you use Windows, in which case the OS will find the file either way.
In the future, please try to explain your problem a little better. Details please!
I'm useing WinXP. I have the spaces at the end of both. The truckport objective is fine. But the other one, is making sure you have 3000 guys in your city. My problem is the text of 'say' cammand. I might of misplaced my strings_default.txt. I put it in the mod directory. My problem excatly like this one:
http://forums.introversion.co.uk/darwin ... ght=script
I did all of that stuff. But wasn't fixed.
http://forums.introversion.co.uk/darwin ... ght=script
I did all of that stuff. But wasn't fixed.
If I understand you properly, you are saying that all of the strings are displayed properly except for the one tagged cityoflifeobj2_1. Is this correct? If so, that rules out about everything I can think of.
So, without seeing the files, I don't think I can offer you any more help. If you like, you can archive the mod, and either post it here (i.e. upload it somewhere, and post link here), or you can email it to me, and I will see what I can do. My email address is in my profile.
xander
- It isn't a problem with the read permissions of strings_default.txt (or any other problem that would render strings_default.txt unreadable, such as the wrong file extension), because other strings are being displayed properly.
- You have already stated that there is a blank line at the end of strings_default.txt, so that can't be the cause.
- The rest of the script is running, so the only problem is with the script finding the proper string, not with Darwinia not being able to execute the script.
So, without seeing the files, I don't think I can offer you any more help. If you like, you can archive the mod, and either post it here (i.e. upload it somewhere, and post link here), or you can email it to me, and I will see what I can do. My email address is in my profile.
xander
I got a wacky idea, but it might be the fix... dunno.
Try renaming your problem Say strings. I mean change the tag you call them by in the Say commands.
Use something WITHOUT a number at the end of the first word. Use something simple like "blah_1" and "blah_2".
Reason: I just did a quick scan of the language.txt file which holds all the original game Say strings... and there are no tags with the format "sssssssssssd_d" where s are letters and d are digits. Your tags might cause an ERROR for no obvious reason... possibly due to an old Say system which got dropped, but whose code still lingers in the engine. The darwinia engine contains LOTS of old code.
Anyhow, in cases like these, the best thing to do is narrow the problem down (which you have already done), then change things which don't affect your intended outcome... like changing your tag names. Also make a dummy level and a dummy script which do nothing but say your strings as soon as you enter... i.e. an Always ScriptTrigger and a script which does nothing but Say your renamed tags. Then gradually add more and more real stuff to your dummy level until the problem shows it's ugly head. Then compare what's different between your dummy level and your problem level. Hopefully something stands out.
Let us know if you figure it out.
EDIT: I'm not real sure if your problem is with the objective text or the script Say text or both. So sorrry if it sounds like I'm answering questions you didn't ask!
Basically I recommend you start renaming things. Including things which are currently named alike. Try changing cityoflifeblah2 to abc and cityoflifeblah2_1 to xyz. That way you can be sure of what is causing the problem. Strip out everything unrelated to the problem from a dummy copy of the level. Simplify. Get that Objective to display properly by itself. Then add stuff back in one by one. The problem could be one thing. Or it could be a special combination of things.
EDIT2: **** load up your mods/modname/game.txt file and delete all the lines of numbers between Buildings_StartDefinition and Buildings_EndDef. The editor leaves crap there each time you create a new level. The engine can do weird things when these numbers are wrong. Usually this section is empty and it gets filled in automatically when you start playing with a profile.
Try renaming your problem Say strings. I mean change the tag you call them by in the Say commands.
Use something WITHOUT a number at the end of the first word. Use something simple like "blah_1" and "blah_2".
Reason: I just did a quick scan of the language.txt file which holds all the original game Say strings... and there are no tags with the format "sssssssssssd_d" where s are letters and d are digits. Your tags might cause an ERROR for no obvious reason... possibly due to an old Say system which got dropped, but whose code still lingers in the engine. The darwinia engine contains LOTS of old code.
Anyhow, in cases like these, the best thing to do is narrow the problem down (which you have already done), then change things which don't affect your intended outcome... like changing your tag names. Also make a dummy level and a dummy script which do nothing but say your strings as soon as you enter... i.e. an Always ScriptTrigger and a script which does nothing but Say your renamed tags. Then gradually add more and more real stuff to your dummy level until the problem shows it's ugly head. Then compare what's different between your dummy level and your problem level. Hopefully something stands out.
Let us know if you figure it out.
EDIT: I'm not real sure if your problem is with the objective text or the script Say text or both. So sorrry if it sounds like I'm answering questions you didn't ask!
EDIT2: **** load up your mods/modname/game.txt file and delete all the lines of numbers between Buildings_StartDefinition and Buildings_EndDef. The editor leaves crap there each time you create a new level. The engine can do weird things when these numbers are wrong. Usually this section is empty and it gets filled in automatically when you start playing with a profile.
The problem is that strings_default.txt was not in the correct directory. It needs to be in the directory with the other mod files. Again, this is a problem that we probably could have diagnosed very easily if you had given us more information about the problems that you were having. Specifically, when I asked
it would have been a good idea if you had told us right then that the other scripts were not working. This would have indicated that strings_default.txt was not being read at all, which would have prevented me from ruling out the following later:
So, assuming that what you sent me has the directory structure of you mod, you need to move all of the files in ColonyWar/ColonyWar/ into ConlonyWar/ , which is where strings_default.txt is currently living.
xander
EDIT: Also, the file should be named "strings_default.txt", not "strings_default .txt". That extra space is screwing you up.
EDIT:
No, this is perfectly alright. Darwinia doesn't care. The numbers after the underscore can be used to combine a lot of say commands into one command, but pretty much anything can go before the final underscore. However, to avoid confusion, I tended to use the format "objA_1 blah blah blah".
xander wrote:You seemed to indicate that your scripts are running properly, including text. Is that the case?
it would have been a good idea if you had told us right then that the other scripts were not working. This would have indicated that strings_default.txt was not being read at all, which would have prevented me from ruling out the following later:
xander wrote:It isn't a problem with the read permissions of strings_default.txt (or any other problem that would render strings_default.txt unreadable, such as the wrong file extension), because other strings are being displayed properly.
So, assuming that what you sent me has the directory structure of you mod, you need to move all of the files in ColonyWar/ColonyWar/ into ConlonyWar/ , which is where strings_default.txt is currently living.
xander
EDIT: Also, the file should be named "strings_default.txt", not "strings_default .txt". That extra space is screwing you up.
EDIT:
briceman2 wrote:Reason: I just did a quick scan of the language.txt file which holds all the original game Say strings... and there are no tags with the format "sssssssssssd_d" where s are letters and d are digits. Your tags might cause an ERROR for no obvious reason... possibly due to an old Say system which got dropped, but whose code still lingers in the engine. The darwinia engine contains LOTS of old code.
No, this is perfectly alright. Darwinia doesn't care. The numbers after the underscore can be used to combine a lot of say commands into one command, but pretty much anything can go before the final underscore. However, to avoid confusion, I tended to use the format "objA_1 blah blah blah".
Same problem without the space too. I tried the dummy level, and the same thing happened, and I put the strings_default.txt in the Mod Directory. I tested it in the Mod and it work fine in the dummy level. It works in the Mod. I never could find where you were suppose to up it. The guides don't say.
Edit: I have a second problem, I don't know how to start a script at the begining of a level, and only run once.
Edit2: Nevermind about second problem.
Edit: I have a second problem, I don't know how to start a script at the begining of a level, and only run once.
Edit2: Nevermind about second problem.
Too Late!
Make the ScriptTrigger Always so it fires as soon as you enter the level, and click the Dynamic field of the ScriptTrigger building so it reads 1.
Non-dynamic buildings never change if you leave the level and the re-enter the level. They are stored in the map files.
Dynamic buildings are stored in the mission files. If youi look inside a profile directory after you play a level (and don't reset the levels), you will see a *copy* of the game.txt plus a bunch of mission files (copies too). No map files are saved in your profile.
So non-dynamic stuff in the map files will always be the same every time you enter a level. Dynamic stuff will get loaded from the saved info in the profile mission files (after the first load from your mod originals). Resetting a level simply deletes the m,ission file from the profile directory.
Things like ScriptTriggers get deleted from the profile mission after they fire. So if you redshirt2 the working mission files, you can see that the ScriptTrigger building is gone..........
.........so it can never fire again until you reset the level and get a fresh copy of the original mission file.
Stuf that should generally be dynamic inculdes: incubators (saves the number of souls in limbo), triffids (deletes em if they die), Anthills (same reason), spam (same reason), scripttriggers you only want to run once. I might be missing something... but xander will correct my list if I am.
Glad you got th strings prob solved.
Make the ScriptTrigger Always so it fires as soon as you enter the level, and click the Dynamic field of the ScriptTrigger building so it reads 1.
Non-dynamic buildings never change if you leave the level and the re-enter the level. They are stored in the map files.
Dynamic buildings are stored in the mission files. If youi look inside a profile directory after you play a level (and don't reset the levels), you will see a *copy* of the game.txt plus a bunch of mission files (copies too). No map files are saved in your profile.
So non-dynamic stuff in the map files will always be the same every time you enter a level. Dynamic stuff will get loaded from the saved info in the profile mission files (after the first load from your mod originals). Resetting a level simply deletes the m,ission file from the profile directory.
Things like ScriptTriggers get deleted from the profile mission after they fire. So if you redshirt2 the working mission files, you can see that the ScriptTrigger building is gone..........
.........so it can never fire again until you reset the level and get a fresh copy of the original mission file.
Stuf that should generally be dynamic inculdes: incubators (saves the number of souls in limbo), triffids (deletes em if they die), Anthills (same reason), spam (same reason), scripttriggers you only want to run once. I might be missing something... but xander will correct my list if I am.
Glad you got th strings prob solved.
Thanks it worked too. Can you do one that fires off when your objectives are complete, if yes then tell me how.
Edit: The cameras don't work in the intro.
Edit2: My objective on the 3,000 dariwians, doesn't say that you completed it when you have 3000 or more dariwians.
Edit: The cameras don't work in the intro.
Code: Select all
CamMove intro1 1
Say cityoflifeintro_1
WaitSay
Say cityoflifeintro_2
WaitSay
CamMove intro2 3
Say cityoflifeintro_3
WaitSay
CamMove intro3 2
Say cityoflifeintro_4
WaitSay
Say cityoflifeintro_5
WaitSay
CamMove intro1 5
Say cityoflifeintro_6
WaitSay
CamReset
Edit2: My objective on the 3,000 dariwians, doesn't say that you completed it when you have 3000 or more dariwians.
Please?Cotcan wrote:Thanks it worked too. Can you do one that fires off when your objectives are complete, if yes then tell me how.
Yes you can. It's more complex and the "trigger" is located in the game.txt file. You can't set these kinds of triggers from inside the editor. You have to use a text editor. Read the game,txt section here: http://www.thenextgame.co.uk/modguide/index.php?p_id=14
Edit: The cameras don't work in the intro.
The script looks fine to me. Do you have cam locations defined for each of those CamMove commands? Are you sure you saved the level after you entered them? FYI: you can look at your level mission file in a text editor and the cam locations will be listed at the top.
Does the script actually get called? I mean, are the Say strings being displayed OK, but no cam action? Or is there nothing at all for your intro?
Edit2: My objective on the 3,000 dariwians, doesn't say that you completed it when you have 3000 or more dariwians.
Is you SafeArea marked as Global? If not, then it will never complete. Also, if you change it to global you will HAVE to delete any game.txt copy in your profile. If you are testing without a profile, then that might also prevent the objective from completing. The imprtant info about online status, building team, and completed objectives is all stored in the working copy of the game.txt file.
Yes thankful the script is called, and it says the stuff. But doesn't move you anywhere. I have the cameras. But they aren't going to the cameras.
LOL my script for the game.txt is now working. I used the guide for it. Must of been the safe area. The cameras seem to only work from the game.txt one. But from the script trigger, the cameras don't work. That's strange.
Code: Select all
CameraMounts_StartDefinition
# Name Pos Front Up
# =========================================================================
intro1 4186.81 907.85 4428.22 -0.43 -0.81 -0.39 -0.60 0.58 -0.55
intro2 3073.71 703.83 2542.86 -0.25 -0.79 -0.56 -0.32 0.61 -0.72
intro3 3770.69 434.95 650.38 0.53 -0.73 0.43 0.57 0.68 0.46
CameraMounts_EndDefinitionLOL my script for the game.txt is now working. I used the guide for it. Must of been the safe area. The cameras seem to only work from the game.txt one. But from the script trigger, the cameras don't work. That's strange.
Who is online
Users browsing this forum: No registered users and 5 guests




