If there's a better version of this, can someone sticky it for this forum. Being able to add logging to any new code is almost essential for debugging problem.
1) Enable Logging (for Scripts at the Least)
In the DAO bin_ship directory where the dao executables are placed, create a file named
ECLog.ini
In it you should place the following 2 lines at least:
[LogTypes]
Script=1
If you want to see a more complete version of the file look at this link on the toolset wiki
http://social.biowar...x.php/ECLog.ini
This
will turn on logging, for scripts.
At the very minimum, your log file will now display all changes to plot flags. But not much more except maybe a forgotten script logging statement or 2.
2) Add Logging to Your Script(s)
Now go to your script and start using the function
PrintToLog()
All over the place. Not that is is a fairly basic Print command, and does not automatically convert number types to strings. So you will have to use IntToString() a lot, and probably FloatToString as well.
But strings can still be concatenated using the + operator.
Here is a simple snippet
PrintToLog("*****************************");
PrintToLog("EVENT_TYPE_MODULE_LOAD seen.");
PrintToLog("*****************************");
Here is an example that reports the values of some variables along with some text
PrintToLog(IntToString(j) + " :: " + sTag + ":Prop=" + IntToString(tmpProp) + ":New=" + IntToString(newPower) + ":Old=" + IntToString(curPower));
This just prints something like
12 :: gen_item_acc_foo :: Prop=1001 :: New=3 :: Old=1
It's there just to provide an more complex example of stringing to get strings and non string values.
Pointer:
The log file will probably have a fair amount of data to dig through. So you probably want to do something to make your own statements stand out.
The first snippet above does that by prints the ********** out before and after the information reported.
So you may want to consider doing that for all your logging.
If you want to make it easier add something like this function to the start of each script or something included in each.
(Edit to to fit your own aesthetic)
void PrintVisibleMsg(string logMessage)
{
PrintToLog("******LOOK HERE!!! LOOK AT ME!! LOOK !!! PAY ATTENTION TO ME!!!");
PrintToLog(logMessage);
PrintToLog("******LOOK HERE!!! LOOK AT ME!! LOOK !!! PAY ATTENTION TO ME!!!");
}
Though I find just PrintToLog("*****************************"); easier on the eyes myself.
3) Run the Game, then Review Your Log
Now that you have added logging statements, run the game and then check the log file.
The log file is named:
DragonAge_1.log
And this time, the file is located in your "My Documents" folder. Specifically under
BioWare\\Dragon Age\\Logs
The log file will have a fair amount of data. The first step to locating you own logging is to remember that all script logging will have the word
Script
Followed by a tab character prefixed to them.
If you turn on other options for logging, each other option should have it's own channel name as its prefix instead.
Here is a sample of some of the many plot flag lines you will
Script GetPlot [gen00pt_class_race_gend] [GEN_RACE_HUMAN] = [ DEFINED ]
Script GetPlot *DEFINED* [gen00pt_class_race_gend] [GEN_RACE_HUMAN] [value of DEFINED flag after evaluation: 0]
Script GetPlot [gen00pt_class_race_gend] [GEN_RACE_HUMAN] = [ DEFINED ]
Script GetPlot *DEFINED* [gen00pt_class_race_gend] [GEN_RACE_HUMAN] [value of DEFINED flag after evaluation: 0]
Script SetPlot [genpt_app_alistair] [APP_ALISTAIR_INC_LOW] [0 -> 1]
The first snippet provide results in something like this: Notice that if you do not do something to make your information stand out, it may be a little tedious to find what you want.
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_ELF_DALISH] = [0]
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_DWARF_COMMONER] = [0]
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_DWARF_NOBLE] = [0]
Script TrackSendGameId: Game ID is 2390500303 FromStart: 0
Script *****************************
Script EVENT_TYPE_MODULE_LOAD seen.
Script *****************************
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_HUMAN_NOBLE] = [0]
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_ELF_CITY] = [0]
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_ELF_DALISH] = [0]
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_DWARF_COMMONER] = [0]
Script GetPlot [gen00pt_backgrounds] [GEN_BACK_DWARF_NOBLE] = [0]
Script TrackSendGameId: Game ID is 2390500303 FromStart: 1
TUTORIAL: Turning on logging
Débuté par
kilrex
, nov. 29 2009 03:07
#1
Posté 29 novembre 2009 - 03:07
#2
Posté 15 décembre 2009 - 12:49
What I usually do when I do a search for something on a wiki and then find the information under a non-obvious title is to create a redirect for my original search term. In this case, for example, I just redirected [[logging]] to [[PrintToLog]]. Now anyone who searches for "logging" will be taken straight there, and people can link to it more easily.
If you wished, you could copy and paste your tutorial to [[Logging]] instead (go to http://social.biowar...ing&redirect=no to edit the existing redirect). Nothing wrong with lots of detail on the wiki, provided there are overviews and summaries as well for people who want to get straight to the heart of the matter.
If you wished, you could copy and paste your tutorial to [[Logging]] instead (go to http://social.biowar...ing&redirect=no to edit the existing redirect). Nothing wrong with lots of detail on the wiki, provided there are overviews and summaries as well for people who want to get straight to the heart of the matter.





Retour en haut






