[Crossfire-wiki] [Crossfire DokuWiki] page changed: dev_todo:time_of_day_based_events
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Tue Nov 13 17:51:26 CST 2007
A page in your DokuWiki was added or changed. Here are the details:
Date : 2007/11/13 17:51
User : tchize
Edit Summary:
@@ -15,14 +15,42 @@
* Monsters like Werewolfs
* Can we (is it copyrighted?) have monsters turn to stone based on the time?
* Items being affected by the time of day
* Perhaps connected values alter/default, so scorn gates are open during the day, closed at night.
+ * Add Gridarta UI to easily use prebuild python scripts
==== current stage ====
+ Note: some things below may only be working currently on developper's computer and may not yet have been commited
=== C code ===
* Transfert of Month/weekday/season names to plugins
* Add notions for periods of the day? (night, dawn, morning, noon, evening, dusk/sunset)
* provide a name->index hastable for periods of day/year
+ === python ===
+ Example (verbose) python code using time based informations
+ <code python>
+ import Crossfire
+ import string
+
+ Crossfire.Log(Crossfire.LogDebug, "Number of seasons for this server: %d" %Crossfire.Time.SEASONS_PER_YEAR)
+ for x in range(Crossfire.Time.SEASONS_PER_YEAR):
+ Crossfire.Log(Crossfire.LogDebug, "Season %d is %s" %(x,Crossfire.GetSeasonName(x)))
+ Crossfire.Log(Crossfire.LogDebug, "Number of week days for this server: %d" %Crossfire.Time.DAYS_PER_WEEK)
+ for x in range(Crossfire.Time.DAYS_PER_WEEK):
+ Crossfire.Log(Crossfire.LogDebug, "weekday %d is %s" %(x,Crossfire.GetWeekdayName(x)))
+ Crossfire.Log(Crossfire.LogDebug, "Number of months for this server: %d" %Crossfire.Time.MONTHS_PER_YEAR)
+ for x in range(Crossfire.Time.MONTHS_PER_YEAR):
+ Crossfire.Log(Crossfire.LogDebug, "Month %d is %s" %(x,Crossfire.GetMonthName(x)))
+
+
+
+ now = Crossfire.GetTime()
+ parameters = string.split(Crossfire.ScriptParameters(),",")
+ current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7])]
+
+ Crossfire.SetReturnValue(1)
+ if (set(parameters) & set(current)):
+ Crossfire.SetReturnValue(0)
+ </code>
=== filter event ===
First stage plans to give possibility for event fitlering using ad hoc python library. example trigger that works only during New Year and/or the Day of the Moon:
<code>
arch button_trigger
IP-Address : 91.177.206.249
Old Revision: http://wiki.metalforge.net/doku.php/dev_todo:time_of_day_based_events?rev=1194997495
New Revision: http://wiki.metalforge.net/doku.php/dev_todo:time_of_day_based_events
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list