mIRC Home    About    Download    Register    News    Help

Print Thread
Event script/alch script/combt calc #186923 28/09/07 11:38 AM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
I have a good event script. Was wondering if I could do 2 interesting things with it:
1) make it so that say 20 or 30 min before the event it will start a countdown and every 4 min say like "Event X in (time remaining) then once the time is up for 10 min or so say "event X is happening now) or something. Is that possible?
2)The command for my bot to erase an event is !setfevent -r #(here it can hold multiple events) is it possible to provided you set a date the bot will autmatically earse the event 24 hours after the event happened?

Anyway here is the script:
on *:TEXT:*:#:{
if ($1 == !setfevent) {
if (($nick isop $chan) || ($nick ishop $chan)) {
if ($2) {
if ($v1 == syntax) {
notice $nick Proper SYNTAX !setfevent [-nrcao] <N|E|EVENT> [INFO]
notice $nick Switches: $&
-n Means NEW, Clears existing events, and starts a new with the new specified event. $&
-r Means REMOVE, Removes N'th event from the event list. $&
-c Means CLEAR, Clears existing events. $&
-a Means ADD, Adds a new event to an existing list of events. $&
-o Means OVERWRITE, Removes event E and replaces it with INFO $&
NOTE: If you specify NO switches, it assumes you want to start one. if one is already in effect, you will need to use the -a switch to add a new event to the list.
halt
}
if ($left($v1,1) == -) {
if (n isin $2) {
if ($ini(events.ini,$chan) != 0) {
if ($3) {
remini events.ini $chan
writeini events.ini $chan 1 $3-
notice $nick event line reset, new event added.
halt
}
else { notice $nick invalid syntax refer to !setfevent syntax | halt }
}
else { notice $nick There is currently no events set, You cannot clear a non-existant event line. | halt }
}
if (c isin $2) {
if ($ini(events.ini,$chan) != 0) { remini events.ini $chan | notice $nick all events have been removed. }
else { notice $nick There is currently no events set, You cannot clear a non-existant event line. }
}
if (a isin $2) {
if ($ini(events.ini,$chan,0) >= 1) { writeini events.ini $chan $calc($ini(events.ini,$chan,0) + 1) $3- | notice $nick an event has been added to the events list }
else { notice $nick There is currently no events set, You cannot add to a non-existant event line. }
}
if (r isin $2) {
if ($ini(events.ini,$chan) != 0) {
if (($3) && ($3 isnum)) {
if ($ini(events.ini,$chan,$3)) {
remini events.ini $chan $3
var %fixini = $3
while (%fixini < $calc($ini(events.ini,$chan,0) + 1)) {
writeini events.ini $chan %fixini $readini(events.ini,$chan,$calc(%fixini +1))
remini events.ini $chan $calc(%fixini + 1)
inc %fixini 1
}
if ($ini(events.ini,$chan,0) == 0) { notice $nick last of the events removed. event line terminated | remini events.ini $chan }
else { notice $nick You have removed the $ord($3) event. }
}
}
else { notice $nick Wrong use of the -r switch! SYNTAX: !setfevent -r <number> }
}
else { notice $nick There is currently no events set, You cannot remove an event from a non-existant event line. }
}
if (o isin $2) {
if ($ini(events.ini,$chan) != 0) {
if ($3 isnum) {
if ($ini(events.ini,$chan,$3)) {
if ($4) {
writeini events.ini $chan $3 $4-
notice $nick You have replaced the $ord($3) event. with $4-
}
else notice $nick invalid use of the -o switch, SYNTAX !setfevent -o <E> <Replace Info>
}
}
else { notice $nick Wrong use of the -o switch! SYNTAX: !setfevent -o <E> <Replace Info> }
}
else { notice $nick There is currently no events set, You cannot overwrite an event from a non-existant event line. }
}
}
else {
if ($ini(events.ini,$chan,0) >= 1) { notice $nick There is already a set of events running, referr to "!setfevent syntax" for more information | return }
else { notice $nick You've started a new event line. | writeini events.ini $chan 1 $2- }
msg $chan  $nick has set a new event!!! Type !event to see it!!
}
}
else {
notice $nick Proper SYNTAX !setfevent [-nrcao] <N|E|EVENT> [INFO]
notice $nick Switches: $&
-n Means NEW, Clears existing events, and starts a new with the new specified event. $&
-r Means REMOVE, Removes N'th event from the event list. $&
-c Means CLEAR, Clears existing events. $&
-a Means ADD, Adds a new event to an existing list of events. $&
-o Means OVERWRITE, Removes event E and replaces it with INFO $&
NOTE: If you specify NO switches, it assumes you want to start one. if one is already in effect, you will need to use the -a switch to add a new event to the list.
halt
}
}
}
if ($1 == !sesyntax) {
notice $nick Proper SYNTAX !setfevent [-nrcao] <N|E|EVENT> [INFO]
notice $nick Switches: $&
-n Means NEW, Clears existing events, and starts a new with the new specified event. $&
-r Means REMOVE, Removes N'th event from the event list. $&
-c Means CLEAR, Clears existing events. $&
-a Means ADD, Adds a new event to an existing list of events. $&
-o Means OVERWRITE, Removes event E and replaces it with INFO $&
NOTE: If you specify NO switches, it assumes you want to start one. if one is already in effect, you will need to use the -a switch to add a new event to the list.
halt
}
if ($1 == !esyntax) {
notice $nick Proper SYNTAX !events [-n] [N]
notice $nick Switches: -n means NUMBER, returns N'th event. if you specify -n N is manditory.
}
if ($1 == !event) {
if (!$ini(events.ini,$chan)) { notice $nick there is currently no events set. | halt }
if ($2) {
if ($2 == -n) {
if (($3 isnum) && ($3 <= $ini(events.ini,$chan,0))) {
notice $nick $ord($3) event from $chan $+ 's event line.
notice $nick $3 $+ . $readini(events.ini,$chan,$3)
}
else { notice $nick invalid syntax OR you chose a number above the amount of listed events. refer to "!events syntax" }
}
if ($2 == syntax) {
notice $nick Proper SYNTAX !events [-n] [N]
notice $nick Switches: -n means NUMBER, returns N'th event. if you specify -n N is manditory.
}
}
else {
if ($ini(events.ini,$chan,0) >= 1) {
notice $nick Events for $chan
var %yah = 0
while (%yah < $ini(events.ini,$chan,0)) {
inc %yah 1
notice $nick $+(%yah,.) $readini(events.ini,$chan,%yah)
}
}
else notice $nick there is no events set on $chan
}
}
}
on *:JOIN:#tlc: {
if ($nick == imfat) {
halt
}
if (!$ini(events.ini,$chan)) { notice $nick there is currently no events set. | halt }
else notice $nick please type !event to see todays event.
}

Also as the title implies I am also looking for a runescape alch text based alh script. As well as a runescape combat calcualter/lvl calaculater. Anyway know where to find either of these?

thanks for the help!

Re: Event script/alch script/combt calc [Re: zad0909] #186935 28/09/07 10:20 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
First of all, you should use CODE tags (the # button in the forum) when posting code so that it's easier to read. Second, avoid using HALT. Use RETURN instead if you really need to. And you don't need to halt an IF when the only thing after it is an ELSE.

As for your questions...

When you add an event, the easiest method would be to just start some timers when creating the new event. Calculate ($calc) time between now and when 20/30 minutes prior to the event time and set a timer for that which will msg the channel. Then set one for 4 minutes after that and so on until the event start time. Again, that's the easiest method... it will mean a number of timers running, which isn't really a bad thing, but may not be the preferable method. You could also set a single timer that calls and alias which then runs a new timer for 4 minutes later that will call the alias again and so on. Then you only have a single timer running. A bit more complicated, but not too bad.

For the second one, again, just use a timer. Set it for 24 hours after the event and have the timer do what the -r does. The easiest way to do that would be to put that into an alias.


Invision Support
#Invision on irc.irchighway.net