mIRC Homepage

[Help] Expiration timer

Posted By: SophisDecay

[Help] Expiration timer - 11/11/14 04:13 AM

I would like for the %Cache and %lastkill to be reset after 2 days from the %teim I've tried my hand at timers and I just can't wrap my head around them.

****in Chan*******

<Chisu> !cache
<NeverMore`>[[Chisu]]*[[Cache: 75 lbs]]*[[Last Kill: Goat ]]*[[On: Mon Nov 10 20:37:57 2014 ]]*[[Expires after two days!]]*[[Last wolves to hunt: Chisu Susista MetalStorm Kajika ]]*[[ #DR*Hunt ]

****************Script where I would like the Timer to start*************
On *:action:*!attacks*:#DR*Hunt: {
if (%member [ $+ [ $nick ] ] == on) && (%tar == on) {
set %hit $rand(0,25)
dec %healthanimal %hit

if (%healthanimal <= 0) {
inc %cache %healtha
set %lastkill %target
set %tiem $asctime
/msg $chan 5,1[[ $+ %theme $+ $nick $+ 5]]15has hit7 %target 15for4 %hit 15damage4*5[[14 Total HP Remaining:15 %healthanimal 5]]4*5[[15 Howl proud! Tonight, we wolves feast!!5]]
/msg $chan 5,1[[15Cache increased to7 %cache 15lbs5]]4*5[[7Last Kill:15 %lastkill 5]]4*5[[7On:15 %tiem 5]]4*5[[7Expires after two days!5]]4*5[[Last wolves to hunt5]]4*5[[15 %hunters 5]]
unset %target
unset %healthanimal
unset %hit
unset %damage
unset %healtha
unset %tar
halt
}
********************Things I've been working on*****************************
on *:text:!Cache*:#:{

>Edit< if (<expires> isin %tiem) set $+(%,tiem_a,%tiem_a_i,_expires) $remove(%tiem,<expires>,</expires>,$chr(9)) |<endedit>

/msg $chan 5,1[[ $+ %theme $+ $nick $+ 5]]4*5[[7Cache:15 %cache lbs5]]4*5[[7Last Kill:15 %lastkill 5]]4*5[[7On:15 %tiem 5]]4*5[[7Expires after two days!5]]4*5[[7Last wolves to hunt:15 %hunters 5]]4*5[[ 5#4D7R8*7H4u5nt ]

}
On *:action:*!attacks*:#DR*Hunt: {
if (%member [ $+ [ $nick ] ] == on) && (%tar == on) {
set %hit $rand(0,25)
dec %healthanimal %hit

if (%healthanimal <= 0) {
inc %cache %healtha
set %lastkill %target

>EDIT< set %tiem $asctime Expires +2 <EndEdit>

/msg $chan 5,1[[ $+ %theme $+ $nick $+ 5]]15has hit7 %target 15for4 %hit 15damage4*5[[14 Total HP Remaining:15 %healthanimal 5]]4*5[[15 Howl proud! Tonight, we wolves feast!!5]]
/msg $chan 5,1[[15Cache increased to7 %cache 15lbs5]]4*5[[7Last Kill:15 %lastkill 5]]4*5[[7On:15 %tiem 5]]4*5[[7Expires after two days!5]]4*5[[Last wolves to hunt5]]4*5[[15 %hunters 5]]
unset %target
unset %healthanimal
unset %hit
unset %damage
unset %healtha
unset %tar
halt
}


Any help would be appreciated!!!
Posted By: westor

Re: [Help] Expiration timer - 11/11/14 12:16 PM

Try to add this into your code but it must exist the %tiem variable if NOT then 2 days will be used to unset the %cache and %lastkill

Help details:

/help /timer
/help $timer

Code:
.timer[EXPIRE_ $+ $chan $+ _ $+ $nick $+ ] 1 $iif(%tiem && %tiem isnum,$v1,172.8) unset %cache %lastkill
Posted By: SophisDecay

Re: [Help] Expiration timer - 11/11/14 07:44 PM

where should it be in the snippet?

Should i put it with this
if (%healthanimal <= 0) {
inc %cache %healtha
set %lastkill %target
set %tiem $asctime <The %Tiem VAR is the Date the kill took place>

.timer[EXPIRE_ $+ $chan $+ _ $+ $nick $+ ] 1 $iif(%tiem && %tiem isnum,$v1,172.8) unset %cache %lastkill
timernotice 1 $calc(%tiem -1) timer 1 20 notice + $+ # Cache is only good for $duration(%tiem) !
Posted By: westor

Re: [Help] Expiration timer - 11/11/14 08:40 PM

put it before the /msg or under it.
Posted By: SophisDecay

Re: [Help] Expiration timer - 12/11/14 12:45 AM

ok it seems to start the timer, not sure if the expiration works yet but we'll see. I'm still not understanding HOW it works, even with reading the tutorials, Could you please explain the evaluation of %tiem && %tiem isnum and how it will know 48 hours has transpired?

And thank you for your help and support thus far!!
Posted By: westor

Re: [Help] Expiration timer - 12/11/14 12:49 AM

You can see if it is running under /timers command, also i gave you an command that will start an timer (/help /timer) and will trigger on %tiem if this variable is available (/help if) and if has only numbers (/help isnum) then it will start with the %tiem details if not then it will start and expire on 2 days as you request it to do.
Posted By: SophisDecay

Re: [Help] Expiration timer - 12/11/14 02:53 AM

smirk its still not working properly, for me anyhoww..
Is there a way to use $calc(%tiem + 178.5)? or to set a %var that on !cache queries to see if the date is expired?

I want it to say
!cache
You have %cache in the Cache, It was put there %tiem , It Expires on %tiem.end
timers and i do not agree, my understanding of them escapes,,
© 2021 mIRC Discussion Forums