mIRC Home    About    Download    Register    News    Help

Print Thread
topic on date and help with $remove #162255 16/10/06 09:12 AM
Joined: Oct 2006
Posts: 23
F
Frenatic Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
how can I set a topic on a spesific date?

like 24th of december it wil change to "mary x-mas" or something (<-- just an example)



and now to the $remove part...

Code:
on *:TEXT:*:#: {
  if ($strip($$1) == !quote) { 
      /msg $chan 3 $+ $read(txt\quote.txt) }

  if ($strip($$1) == !addquote ) { 
     /write txt\quote.txt $2- 11:: 7added by $nick 
     /msg $chan 3done }
}


I want it strip away all the text formating codes (like bold or color) that the user enters when they are adding quotes but still keep the textformating which the script generates
Code:
 11:: 7added by $nick 

Re: topic on date and help with $remove #162256 16/10/06 01:29 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You could set a timer to check the date every 24 hours. I'm not sure of a better way to do that unless you join/connect every day and could put it into an on join event.

Code:
.timerchristmas 0 0:01 checkdate
alias checkdate {
  if ($date == 24/12/2006) {
    topic #yourchannel Merry Christmas!
    .timerchristmas off
  }
}


This was just a matter of including $strip to what you were writing. Also, you don't need /'s on commands in a script, and $$1 in your previous $strips is unnecessary... there will always be a $1, so you don't need to prevent it from runnning when there isn't one (that's what double $ means).

Code:
on *:TEXT:*:#: {
  if ($strip($1) == !quote) {
    msg $chan 3 $+ $read(txt\quote.txt)
  }
  if ($strip($1) == !addquote ) {
    write txt\quote.txt $strip($2-) 11:: 7added by $nick
    msg $chan 3done
  }
}


Invision Support
#Invision on irc.irchighway.net
Re: topic on date and help with $remove #162257 16/10/06 03:02 PM
Joined: Oct 2006
Posts: 23
F
Frenatic Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
the quote script worked but I got some problems with the date script,

I guess that the green text is the time but what does the red "0" mean?

well, the script would basicly not run, does it mather in which tab I put them in? like remote, popups and so on?

Quote:

Code:
.timerchristmas [color:red]0[/color] [color:green] 0:01[/color] checkdate
alias checkdate {
  if ($date == 24/12/2006) {
    topic #yourchannel Merry Christmas!
    .timerchristmas off
  }
}

Re: topic on date and help with $remove #162258 16/10/06 04:09 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
the red 0 is the amount of repetitions, 0 being repeat continuously. If that was a 1 it would execute once then stop the timer. As it's 0 it checks every time the 0:01 happens, i.e every day.

/help /timer


btk

Last edited by billythekid; 16/10/06 04:11 PM.

billythekid
Re: topic on date and help with $remove #162259 16/10/06 06:27 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah. You want it to be 0 so it will keep checking at 1 minute past midnight every day. When it is the correct day, it will turn the timer off.

Just as a note to build off what I posted... You may want to start that timer in an on START event so that it will not stop running when you close/open mIRC.

Code:
on *:start: {
  .timerchristmas 0 0:01 checkdate
}
alias checkdate {
  if ($date == 24/12/2006) {
    topic #yourchannel Merry Christmas!
    .timerchristmas off
  }
}


And, yes, you put this into a new remote file... Go into remotes, select File > New, and paste.


Invision Support
#Invision on irc.irchighway.net
Re: topic on date and help with $remove #162260 17/10/06 07:39 AM
Joined: Oct 2006
Posts: 23
F
Frenatic Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
this is the code that I used

Code:
on *:start: {
  .timerchristmas 0 9:30 checkdate
}
alias checkdate {
  if ($date == 17/10/2006) {
    topic #Kichigaijimata look at me mommy! I can change topic! Yaaaaay!!!
    .timerchristmas off
  }
}


everything in the remote tab. i couldent get it to work, so I added a echo so I could see if it was trigged, which it werent. any idea what's wrong?

EDIT: typos

Last edited by Frenatic; 17/10/06 07:50 AM.
Re: topic on date and help with $remove #162261 17/10/06 08:13 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Code:
on *:start: {
  [color:green]; This will 'fire' at 9:28 but then wait till 9:30:10 before actually executing the checkdate alias[/color]
  .timerchristmas 9:28 1 130 checkdate
}
alias checkdate {
  [color:green]; check the date has reached the target date, if not, reset timer for tomorrow[/color]
  if $date(mmdd) &lt; 1017 {  .timerchristmas -o 9:28 1 130 checkdate }
  else {
    [color:green]; the target date has been reached[/color]
    [color:green]; check if you are an op and able to change topic[/color]
    if $me isop #Kichigaijimata { topic #Kichigaijimata look at me mommy! I can change topic! Yaaaaay!!! }
    [color:green]; if not recheck in an hour[/color]
    else .timerchristmas -o 1 3600 checkdate
  }
}


Edited and redited, to fix sloppy formatting.. LOL

Last edited by deegee; 17/10/06 08:30 AM.
Re: topic on date and help with $remove #162262 17/10/06 01:42 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Sorry. Formatted the use of the time incorrectly. I should have had:

.timerchristmas 0:01 0 1 checkdate

I should stop helping when I don't have mIRC in front of me. At least with things I don't usually do in my own scripts.


Invision Support
#Invision on irc.irchighway.net
Re: topic on date and help with $remove #162263 17/10/06 03:22 PM
Joined: Oct 2006
Posts: 23
F
Frenatic Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
tried it now but I cant get it to work, it doesent echo me anything so I can't say whats wrong frown

and I dident change anything from:

Quote:
Code:
on *:start: {
  [color:green]; This will 'fire' at 9:28 but then wait till 9:30:10 before actually executing the checkdate alias[/color]
  .timerchristmas 9:28 1 130 checkdate
}
alias checkdate {
  [color:green]; check the date has reached the target date, if not, reset timer for tomorrow[/color]
  if $date(mmdd) &lt; 1017 {  .timerchristmas -o 9:28 1 130 checkdate }
  else {
    [color:green]; the target date has been reached[/color]
    [color:green]; check if you are an op and able to change topic[/color]
    if $me isop #Kichigaijimata { topic #Kichigaijimata look at me mommy! I can change topic! Yaaaaay!!! }
    [color:green]; if not recheck in an hour[/color]
    [color:red]else .timerchristmas -o 1 3600 checkdate[/color]
  }
}


Edited and redited, to fix sloppy formatting.. LOL


...exept the time

and one thing i thought about, if the client is offline at the specific time, will it then change topic when I connect or do I have to add some thing so it continues to check during the whole day. or can the red text still check the next hour wihtout beeing online at the specific time

Re: topic on date and help with $remove #162264 17/10/06 04:34 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Well, it does work.
First see if the timer is set, and for what time/delay by typing "/timer" (without quotes)
If it is listed "/timerchristmas -e" will trigger it <now>

Also you can paste this to set the timer with a 1 ms delay "/timerchristmas 1 0 checkdate"

One thing you may not be aware of is that the [time] component is 24 hr format, 0-11 for AM and 12-23 for PM times, example, 6:24 PM would be written as 18:24

Quote:
and one thing i thought about, if the client is offline at the specific time, will it then change topic when I connect or do I have to add some thing so it continues to check during the whole day. or can the red text still check the next hour wihtout beeing online at the specific time

Yes, the red line will keep trying hourly until you do connect again and have ops in that channel, unless mIRC is closed down.

Re: topic on date and help with $remove #162265 17/10/06 04:41 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Yeah, I actually mentioned the syntax was wrong and gave correct usage originally, but it got lost in one of the edits. All that got left was my slightly different take on things. :tongue: Sorry about that smile

Again though, that syntax isn't quite right, it will fire at a minute past, but then trigger continuously.
It needs to have 86400 for the delay to happen once a day, ony then it will wait until "a minute past" + 86400 for the first execution of the command unless you manage to trip it with the -e switch. So basically, you'd need two timers when starting it up...
Thats one reason I used the 130secs delay with the time set to 2mins earlier in my example.

Re: topic on date and help with $remove #162266 18/10/06 12:00 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Sheesh. I was having a really bad day there. Yes, it should have 86400 rather than 1.

Frenatic, when you start this, you will *NOT* see anything happen. It will run in the background until the given date/time.


Invision Support
#Invision on irc.irchighway.net
Re: topic on date and help with $remove #162267 18/10/06 07:17 AM
Joined: Oct 2006
Posts: 23
F
Frenatic Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
I Figured that I wouldent see anything untill the script was trigged smile

I still havent got it to work though frown
for todays atempt I changed the time to "9:10" on both rows and date to "1018", then I tried /timers and got

Quote:
* Active timers:
* Timer christmas 17:18 1 time(s) 130s delay checkdate (QuakeNet)


I guess that means that the script wants to fire at 17:18, am I correct? and why would it do so?

Re: topic on date and help with $remove #162268 18/10/06 03:31 PM
Joined: Oct 2006
Posts: 23
F
Frenatic Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Oct 2006
Posts: 23
It did go of at 17:20, and now it's locked at 9:10 and wont change time when I tell it to :s
and I didn't change to 9:10, it dit that by itself