(02-25-2016, 02:14 AM)Spelos Wrote: You can just work with its subString
PushBackBook2(string &in asTimer)
{
SetPropObjectStuckState(StringSub(asTimer, 1, 12), 0);
}
And basically just get 12 characters of asTimer excluding the first one.
Other way would be to declare a LocalVariable for the current book.
Something like this:
PushBackBook1(string &in asTimer)
{
SetPropObjectStuckState(asTimer, -1); //Pushes the book back
SetLocalVarString("CurrentBook", asTimer);
AddTimer("2"+asTimer, 0.25f, "PushBackBook02"); //then just 0.25 seconds later the same book is put into the normal state.
}
PushBackBook2(string &in asTimer)
{
SetPropObjectStuckState(GetLocalVarString("CurrentBook"), 0);
}
Substring seems to be the way to go, though somehow I still got this feeling there has to be an even better way lol.
I thought of the variable solution as well, but the problem with it is that we are dealing with multiple timers for each book here, so if say CurrentBook was Book1, but at the same time we had a timer going for Book2, which expires before Book1 is passed to PushBackBook2, then CurrentBook would be set to Book2, and PushBackBook2 would end up operating on it twice, without ever doing the operation on Book1.
Since in this particular situation the timer expires after only 0.25 sec it's extremely unlikely if not impossible that this would occur, but in similar scripts where the timer does not run out so quickly it would be a problem.
anyway thanks a lot, this real helpful