Circle of Eight Forum

Go Back   Circle of Eight Forum > ToEE Modding > General Modification
User Name
Password
Register FAQ Members List Calendar JavaChat Mark Forums Read

Reply
 
Thread Tools
Old December 28th, 2006   #1
Cerulean the Blue
Blue Meanie
 
Cerulean the Blue's Avatar
 
Join Date: Apr 2005
Location: Portland, Oregon
Posts: 1,959
The game.time Method and Making Reliable Timed Events

This thread is for comments, questions and discussion of this post on the game.time method and this post on making reliable timed events.
__________________
"No. The only thing that lasts forever is apathy. But who cares."

Last edited by Cerulean the Blue; December 28th, 2006 at 02:25 PM.
Cerulean the Blue is offline   Reply With Quote
Old December 28th, 2006   #2
Allyx
Master Crafter
 
Allyx's Avatar
 
Join Date: Dec 2004
Location: U.K.
Posts: 3,300
Re: The game.time Method and Making Reliable Timed Events

Cool stuff there Blue, that woodcutter's time event has never triggered propperly for me, I'm glad you got it figured out. Good work guys.
__________________
"I don't want it back. You can never get rid of the smell, you know. Besides, that dagger was Flint's!" - Tasslehoff Burrfoot.

Allyx is offline   Reply With Quote
Old December 28th, 2006   #3
Elhoim
Goblin Raider
 
Join Date: Dec 2006
Posts: 13
Re: The game.time Method and Making Reliable Timed Events

Blue, do you think it´s possible to unify the various time feedbacks? I mean, in the main GUI it tells you the time elapsed since you started, and it´s like that in the rumors tab, but in the quest tab they are by day of the month and it´s kinda confusing having day 1 in one and day 15 in the other.

Thanks!
Elhoim is offline   Reply With Quote
Old December 28th, 2006   #4
Cerulean the Blue
Blue Meanie
 
Cerulean the Blue's Avatar
 
Join Date: Apr 2005
Location: Portland, Oregon
Posts: 1,959
Re: The game.time Method and Making Reliable Timed Events

The dates and times in the GUI and the logbook are functions of the game engine, i.e. it would take a major dll hack to change them. So no, that is not going to happen.

I've added modified versions of Tillahi's and Sargen's scripts to the Timed Event post.

If I could get people to test these out it would be really helpful.
__________________
"No. The only thing that lasts forever is apathy. But who cares."

Last edited by Cerulean the Blue; December 28th, 2006 at 03:37 PM.
Cerulean the Blue is offline   Reply With Quote
Old December 28th, 2006   #5
Shiningted
Gophers, consarn it!
 
Shiningted's Avatar
 
Join Date: Oct 2004
Location: Sydney
Posts: 9,553
Re: The game.time Method and Making Reliable Timed Events

Good work Blue I was going to use nested time thingy's like this for KotB, good to see someone making it easy to do.
Shiningted is offline   Reply With Quote
Old December 28th, 2006   #6
Sitra Achara
Demon Lord
 
Join Date: Sep 2003
Location: Israel
Posts: 598
Re: The game.time Method and Making Reliable Timed Events

Nifty I've been waiting for this. I'll test as soon as I can (which could be a while, unfortunately).
Sitra Achara is offline   Reply With Quote
Old January 1st, 2007   #7
Cerulean the Blue
Blue Meanie
 
Cerulean the Blue's Avatar
 
Join Date: Apr 2005
Location: Portland, Oregon
Posts: 1,959
Re: The game.time Method and Making Reliable Timed Events

I've Incorporated my Long Interval Timed Event code into an importable module so that it can be used with a call much similar to that of game.timevent_add.

The following is from the documentation included in TimedEvent.py.
Code:
  LONG DURATION TIMED EVENT METHOD by Cerulean the Blue

You must put these in the global namespace of your function:

import _include
from co8Util.TimedEvent import *

Furthermore "import _include" (without quotes) must be included
in the namespace of utilities.py for the method to function across
saves and loads.  Without this the game will not be able to import
co8Util.TimedEvent at startup and the save will be deemed corrupt.

Call form:

timedEventAdd(<function name>, (<arguments>), <interval>, stopFlags=[<stopFlags>], stopVars=[<stopVars>], stopQuests=[<stopQuests>])

<function name> - Name of the function you want executed after 
the interval.  The function must be in the same module as the 
call, or imported to the module.

<arguments> - The arguments you want passed to the function 
separated by comas, i.e. "attachee, triggerer".

<interval> - An int specifying the delay, in hours, till you 
want the function to execute.

<stopFlags> - OPTIONAL - The flag numbers of global flags that 
should stop the function from executing separated by comas.  
If having the flag set should cause the stop just list the flag 
number.  If not having the flag set should cause the stop, put 
the flag number and 0 separated by a coma in parenthesis, i.e. (85,0).  
Any number of stop flags can be passed.
Example: [58, (51,0)]

<stopVars> - OPTIONAL - Like stopFlags, but for global variables.  
Put each number of the global variable and the value that should 
cause the stop, separated by a coma,in parenthesis.  Any number 
of variables can be listed.
Example:  [(21, 4), (36, 10)]

<stopQuests> - OPTIONAL - Like stopFlags, but for quests.  Put each 
quest number and the quest state that should cause the stop, separated 
by a coma, in parenthesis.  Any number of quests can be listed.
Example:  [(21, qs_accepted), (101, qs_completed), (34, qs_botched)]

Sample Calls:

2 arguments, 10 hour delay, no stops:  
timedEventAdd(spawn, (attachee, triggerer), 10)

No arguments, 100 hour delay, flag stops:  
timedEventAdd(spawn, (), 100, stopFlags=[58, (51,0)])

No arguments, 34 hour delay, variable stops:  
timedEventAdd(spawn, (), 34, stopVars=[(21,4)])

3 arguments, 56 hour delay, flag and quest stops:  
timedEventAdd(give_reward, (x,y,z), 56, stopFlags=[82, 132], stopQuests=[(22, qs_completed)])

Logging has been left in to facilitate debugging.  
The log, named LOG_co8Util.TimedEvent.log, will be 
in the modules folder of the module being run.
As you can see timedEventAdd is very similar to game.timevent_add, and can be called virtually identically. It has the added functionality of optionally specifying flags, variables and quest states that will stop the event from happening. These are checked when the delay time has passed, so the timevent sequence always runs to completion. Another difference is that timedEventAdd works with the delay in hours, not milliseconds like timevent_add. Also, timeEventAdd counts time spent resting or passing time toward the delay passing, which timevent_add often does not.

I recommend using timedEventAdd for delays of more than 24 hours. Use timevent_add for delays of 24 hours or less, unless you absolutely need the added functionality.

Attached is TimeEvent.py, utilities.py, and a sample script to demonstrate the method. TimeEvent.py should go into the data\scr\co8Util folder. The other two go into the data\scr folder. The sample script also has some documentation of the method included inside it.
Attached Files
File Type: rar TimedEvent.rar (1.6 KB, 5 views)
File Type: rar Sample TimedEvent Script.rar (752 Bytes, 4 views)
File Type: rar utilities.rar (2.7 KB, 4 views)
__________________
"No. The only thing that lasts forever is apathy. But who cares."

Last edited by Cerulean the Blue; January 1st, 2007 at 08:44 PM.
Cerulean the Blue is offline   Reply With Quote
Old January 1st, 2007   #8
Cerulean the Blue
Blue Meanie
 
Cerulean the Blue's Avatar
 
Join Date: Apr 2005
Location: Portland, Oregon
Posts: 1,959
Re: The game.time Method and Making Reliable Timed Events

The Woodcutter's, Thrommel's, Tillahi's, and Sargen's scripts altered to use the method posted above. These go in the data\scr folder.
Attached Files
File Type: rar py00025woodcutter.rar (639 Bytes, 5 views)
File Type: rar py00149thrommel.rar (561 Bytes, 3 views)
File Type: rar py00127tillahi.rar (409 Bytes, 3 views)
File Type: rar py00166sargen.rar (601 Bytes, 3 views)
__________________
"No. The only thing that lasts forever is apathy. But who cares."
Cerulean the Blue is offline   Reply With Quote
Old June 22nd, 2007   #9
Zebedee
Mindflayer
 
Zebedee's Avatar
 
Join Date: Apr 2005
Posts: 1,754
Re: The game.time Method and Making Reliable Timed Events

Can I confirm whether or not the files listed above were added to the CMF?
Zebedee is offline   Reply With Quote
Old June 22nd, 2007   #10
Allyx
Master Crafter
 
Allyx's Avatar
 
Join Date: Dec 2004
Location: U.K.
Posts: 3,300
Re: The game.time Method and Making Reliable Timed Events

Yes Zebedee, of course you can.

Actually it is in the latest CMF patch (version 5.0.4 composed by yours truely) if you don't believe me it says so here.
__________________
"I don't want it back. You can never get rid of the smell, you know. Besides, that dagger was Flint's!" - Tasslehoff Burrfoot.

Allyx is offline   Reply With Quote
Old June 25th, 2007   #11
Zebedee
Mindflayer
 
Zebedee's Avatar
 
Join Date: Apr 2005
Posts: 1,754
Re: The game.time Method and Making Reliable Timed Events



Always good to make sure there are no misunderstandings and people getting the wrong files in the wrong order.
Zebedee is offline   Reply With Quote
Reply



Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:31 PM.
Our Host!


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Circle of Eight Design by Ian Miles "Sol Invictus" Cheong