mIRC Home    About    Download    Register    News    Help

Print Thread
#249011 11/11/14 04:13 AM
S
SophisDecay
SophisDecay
S
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!!!

Last edited by SophisDecay; 11/11/14 09:30 AM.
Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
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

S
SophisDecay
SophisDecay
S
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) !

Last edited by SophisDecay; 11/11/14 07:48 PM.
Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
put it before the /msg or under it.

S
SophisDecay
SophisDecay
S
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!!

Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
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.

S
SophisDecay
SophisDecay
S
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,,


Link Copied to Clipboard