Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add more script timer debug output
  • Loading branch information
dscharrer committed Nov 21, 2013
1 parent b93ae06 commit 7bdfb53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/script/Script.cpp
Expand Up @@ -1755,6 +1755,7 @@ long ARX_SCRIPT_CountTimers() {
//*************************************************************************************
void ARX_SCRIPT_Timer_ClearByNum(long timer_idx) {
if(scr_timer[timer_idx].exist) {
LogDebug("clearing timer " << scr_timer[timer_idx].name);
scr_timer[timer_idx].name.clear();
ActiveTimers--;
scr_timer[timer_idx].exist = 0;
Expand Down Expand Up @@ -1910,6 +1911,10 @@ void ARX_SCRIPT_Timer_Check() {
}
}

#ifdef ARX_DEBUG
std::string name = st->name;
#endif

if(st->times == 1) {
ARX_SCRIPT_Timer_ClearByNum(i);
} else {
Expand All @@ -1920,7 +1925,10 @@ void ARX_SCRIPT_Timer_Check() {
}

if(es && ValidIOAddress(io)) {
LogDebug("running timer \"" << name << "\" for entity " << io->idString());
ScriptEvent::send(es, SM_EXECUTELINE, "", io, "", pos);
} else {
LogDebug("could not run timer \"" << name << "\" - entity vanished");
}

}
Expand Down
9 changes: 5 additions & 4 deletions src/script/ScriptedLang.cpp
Expand Up @@ -390,6 +390,7 @@ class SendEventCommand : public Command {

Entity * t = entities.getById(target, io);
if(!t) {
DebugScript(": target does not exist");
EVENT_SENDER = oes;
return Failed;
}
Expand Down Expand Up @@ -850,19 +851,17 @@ void timerCommand(const string & timer, Context & context) {

string command = context.getWord();

DebugScript(' ' << options << ' ' << command);

Entity * io = context.getEntity();

if(command == "kill_local") {
DebugScript(' ' << options << " kill_local");
DebugScript(" kill_local");
ARX_SCRIPT_Timer_Clear_All_Locals_For_IO(io);
return;
}

ARX_SCRIPT_Timer_Clear_By_Name_And_IO(timername, io);
if(command == "off") {
DebugScript(' ' << options << " off");
DebugScript(timername << " off");
return;
}

Expand All @@ -873,6 +872,8 @@ void timerCommand(const string & timer, Context & context) {
millisecons *= 1000;
}

DebugScript(timername << ' ' << options << ' ' << count << ' ' << millisecons);

size_t pos = context.skipCommand();

long num = ARX_SCRIPT_Timer_GetFree();
Expand Down

0 comments on commit 7bdfb53

Please sign in to comment.