Advertisement
Guest User

Untitled

a guest
Aug 18th, 2013
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. /*********************************************
  2. * is1 is the session with UI component, set it to
  3. * the session you load your UI counter window in
  4. *
  5. * could be changed to "all" if you display on all
  6. *************************************************/
  7. variable(global) timerController timers = "is1"
  8.  
  9. objectdef timerController
  10. {
  11. variable collection:int timers
  12. variable string _uiSession
  13. variable int timeScale = 300
  14. variable time endAt
  15.  
  16. method Initialize(string uiSession)
  17. {
  18. _uiSession:Set[${uiSession}]
  19. }
  20.  
  21. method addTimer(string timerName, int duration)
  22. {
  23. endAt:Set[${Math.Calc[${Time.Timestamp}+${duration}]}]
  24.  
  25. timers:Set[${timerName}, ${endAt.Timestamp}]
  26. relay ${_uiSession} UIElement[${timerName}]:SetValue[1]
  27.  
  28. ;echo timer ${timerName} with duration ${duration} started at ${Time.Time24}, ends at ${endAt.Time24} for UI session ${_uiSession}
  29. }
  30.  
  31. method removeTimer(string timerName)
  32. {
  33. timers:Erase[${timerName}]
  34. relay ${_uiSession} UIElement[${timerName}]:SetValue[0]
  35. }
  36.  
  37. method updateTimers()
  38. {
  39. variable float progress = 0
  40.  
  41. if "${timers.FirstKey(exists)}"
  42. {
  43. do
  44. {
  45. ; Display the current key
  46. endAt:Set[${timers.CurrentValue}]
  47.  
  48. progress:Set[${Math.Calc[(${endAt.Timestamp}-${Time.Timestamp})/${timeScale}]}]
  49.  
  50. if ${progress} < 0
  51. {
  52. this:removeTimer[${timers.CurrentKey}]
  53. }
  54. else
  55. {
  56. if ${progress} > 1
  57. {
  58. progress:Set[1]
  59. }
  60.  
  61. relay ${_uiSession} UIElement[${timers.CurrentKey}]:SetValue[${progress}]
  62.  
  63. ;echo ${Time.Time24} ${timers.CurrentKey} has progress ${progress} ends at ${endAt.Time24}
  64. }
  65. }
  66. while "${timers.NextKey(exists)}"
  67. }
  68. }
  69. }
  70.  
  71. function main()
  72. {
  73. AddTrigger EQ1_OnLoggingEnabled "[@datetime@] Logging to 'eqlog.txt' is now *ON*."
  74.  
  75. AddTrigger EQ1_StartIcecladTimer "[@trash@] You feel the preservation of the Iceclad surround you."
  76. AddTrigger EQ1_IcecladFade "[@trash@] The preservation of the Iceclad fades away."
  77.  
  78. AddTrigger EQ1_StartCanniTimer "[@trash@] Your body aches as your mind clears.@IgnoreStuff@"
  79. AddTrigger EQ1_StartBardAuraTimer "[@trash@] You are surrounded by the @ignoreAuraType@ of Va'Ker."
  80. AddTrigger EQ1_StartShmHasteTimer "[@trash@] You begin casting Talisman of Celerity."
  81.  
  82. AddTrigger EQ1_TellsYou "[@trash@] @ChannelFrom@ @MerchantCheck@tells you,@IgnoreLanguage@ '@ChannelWhat@'"
  83.  
  84. /* some other examples from lax's POC code
  85. AddTrigger EQ1_YouSay "[@trash@] You say, '@ChannelWhat@'"
  86. AddTrigger EQ1_AFKOn "[@datetime@] You are now A.F.K. (Away From Keyboard)."
  87. AddTrigger EQ1_AFKOff "[@datetime@] You are no longer A.F.K. (Away From Keyboard)."
  88. AddTrigger EQ1_AuctionMsg "[@datetime@] @ChannelFrom@ auctions,@IgnoreLanguage@ '@ChannelWhat@'"
  89. AddTrigger EQ1_ChannelMsg "[@datetime@] @ChannelFrom@ tells @chat@:@num@, '@ChannelWhat@'"
  90. AddTrigger EQ1_GroupMsg "[@datetime@] @ChannelFrom@ tells the group,@IgnoreLanguage@ '@ChannelWhat@'"
  91. AddTrigger EQ1_GuildMsg "[@trash@] @ChannelFrom@ tells the guild,@IgnoreLanguage@ '@ChannelWhat@'"
  92. AddTrigger EQ1_OOCMsg "[@trash@] @ChannelFrom@ says out of character,@IgnoreLanguage@ '@ChannelWhat@'"
  93. AddTrigger EQ1_RaidMsg "[@trash@] @ChannelFrom@ tells the raid, @extraspace@'@ChannelWhat@'"
  94. AddTrigger EQ1_SayMsg "[@trash@] @ChannelFrom@ says,@IgnoreLanguage@ '@ChannelWhat@'"
  95. AddTrigger EQ1_ShoutMsg "[@trash@] @ChannelFrom@ shouts,@IgnoreLanguage@ '@ChannelWhat@'"
  96. AddTrigger EQ1_TellMsg2 "[@trash@] @MerchantCheck@.@ChannelFrom@ told you, '@ChannelWhat@'"
  97. */
  98.  
  99. LogReader:RegisterLog["logs/eqlog_*.txt","EQ1_ChatLog"]
  100.  
  101. LavishScript:RegisterEvent[EQ1_ChatLog]
  102.  
  103. Event[EQ1_ChatLog]:AttachAtom[OnEQ1ChatLog]
  104.  
  105. while 1
  106. {
  107. wait 5
  108. timers:updateTimers[]
  109. }
  110.  
  111. }
  112.  
  113. atom EQ1_StartIcecladTimer(string _Line, string _DateTime)
  114. {
  115. timers:addTimer["timer1@timers@eqtimers", 150]
  116. }
  117.  
  118. atom EQ1_StartCanniTimer(string _Line, string _DateTime)
  119. {
  120. timers:addTimer["timer2@timers@eqtimers", 140]
  121. }
  122.  
  123. atom EQ1_StartBardAuraTimer(string _Line, string _DateTime)
  124. {
  125. timers:addTimer["timer3@timers@eqtimers", 1800]
  126. }
  127.  
  128. atom EQ1_StartShmHasteTimer(string _Line, string _DateTime)
  129. {
  130. timers:addTimer["timer4@timers@eqtimers", 3600]
  131. }
  132.  
  133. atom EQ1_IcecladFade(string _Line, string _DateTime)
  134. {
  135. if ${InnerSpace.Build}>=5607
  136. {
  137. uplink speak "recast iceclad"
  138. }
  139. }
  140.  
  141. atom EQ1_TellsYou(string _Line, string _DateTime, string _ChannelFrom, string _merchantCheck, string _IgnoreLanguage, string text)
  142. {
  143. if ${InnerSpace.Build}>=5607
  144. {
  145. uplink speak "tell from ${_ChannelFrom.Escape}. ${text.Escape}"
  146. }
  147. }
  148.  
  149. atom EQ1_YouSay(string _Line, string _DateTime, string text)
  150. {
  151. echo EQ1_YouSay[\"${_Line.Escape}\",\"${_DateTime.Escape}\",\"${text.Escape}\"]
  152. if ${InnerSpace.Build}>=5607
  153. {
  154. uplink speak "You say, ${text.Escape}"
  155. }
  156. }
  157.  
  158. atom EQ1_OnLoggingEnabled(string _Line, string _DateTime)
  159. {
  160. echo EQ1_OnLoggingEnabled[\"${_Line.Escape}\",\"${_DateTime.Escape}\"]"
  161. }
  162.  
  163. atom EQ1_AFKOn(string _Line, string _DateTime)
  164. {
  165. echo EQ1_AFKOn()
  166. }
  167.  
  168. atom EQ1_AFKOff(string _Line, string _DateTime)
  169. {
  170. echo EQ1_AFKOff()
  171. }
  172.  
  173. atom EQ1_SayMsg(string _Line, string _DateTime, string _ChannelFrom, string _IgnoreLanguage, string text)
  174. {
  175. echo EQ1_SayMsg
  176. if ${InnerSpace.Build}>=5607
  177. {
  178. uplink speak "${_ChannelFrom.Escape} says, ${text.Escape}"
  179. }
  180. }
  181.  
  182. atom OnEQ1ChatLog(string filename, string action, string text)
  183. {
  184. ;echo "OnEQ1ChatLog[\"${filename.Escape}\",\"${action.Escape}\",\"${text.Escape}\"]"
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement