# irc reminder

### By Daking on Dec 19, 2010

here's a little snippet i made for an online mafia game that required a timer after buying bullets. (having a text C/P on IRC(trigger))
it has Nick Event.

its for a bot
put it in a new remote
example: Success, you bought 495 bullets for \$ 241,000

BOT> [NICK] bought 495 bullets for \$482 per bullet. (With Hammer)
-BOT- you will be reminded when you can buy new bullets

Success, you bought 1000 bullets for \$ 346,000
BOT> [NICK] bought 1000 bullets for \$346 per bullet. (No Hammer)
-BOT- you will be reminded when you can buy new bullets

since this bullet buying is 1 hr limited the timer was set for an hour to remind.
works with 6.31 and up (tested) (i use 6.35)

a nick event has been added
pls comment and tell me for some bugs/typo's/or tinyfying xD

Edit: my first posted snippet btw so pls be gentle with your remarks but all help is welcome ofc.
P.s. Napa ur my hero o

``````on *:text:Success, you bought*:#:{
var %i = \$remove(\$8,\$chr(44)))
var %j = %i / \$4
var %k = \$calc((\$4 / 100) * 1)
var %l = \$calc(%i / (\$4 + %k))
if (\$round(%j,0) != %j) { msg \$chan 7 \$nick 10bought11 \$4 10bullets for5 \$ \$+ \$round(%l,0) 10per bullet. 4(With Hammer) }
if (\$round(%j,0) == %j) { msg \$chan 7 \$nick 10bought11 \$4 10bullets for5 \$ \$+ %j 10per bullet. 5(No Hammer) }
/notice \$nick you will be reminded when you can buy new bullets
var %meh = [ %Rem ] \$+ bullets.txt
/write %meh \$nick | /write bullets.txt %meh
/timer 1 3600 /bullets \$chan %meh
}
alias bullets {
if (%t ison \$1) { msg \$1 7 %t 10Go and get ur bullets mofo!!(because you can again) 4Good Luck !! }
/remove \$2
/write -dw \$2 bullets.txt
}
on *:PART:#: {
var %meh = [ %Rem ] \$+ bullets.txt
if (\$read(bullets.txt, w, %meh) == \$null) { halt }
else { /write -ds %meh bullets.txt }
}
on *:QUIT: {
var %meh = [ %Rem ] \$+ bullets.txt
if (\$read(bullets.txt, w, %meh) == \$null) { halt }
else { /write -ds %meh bullets.txt }
}
on *:NICK:{
var %meh = [ %Rem ] \$+ bullets.txt
if (\$read(bullets.txt, w, %meh) == \$null) { halt }
else { /write -c %meh \$newnick }
}
``````

Jethro   -  Dec 19, 2010

Well as no one is perfect and mistakes can happen...^^ Plus it was a quick review. Thanks for spotting the obvious.

Though you could use \$gettok in place of the \$remove.

_Teen_   -  Dec 19, 2010

closing bracket missed on Jethro_'s code

by the way, i dont know why use \$chr(64) \$chr(33) and \$chr(42)

u can use \$remove(\$wildsite,!@,.users.omerta) will be 22 bytes shorter

``````on *:PART:#:bulletss
on *:QUIT:bulletss
on *:NICK:bulletss
alias -l bulletss {
var %Rem = \$remove(\$wildsite,*!*@,.users.omerta)
var %meh = [ %Rem ] \$+ bullets.txt
/write \$+(-,\$iif(\$event == nick,c \$newnick,ds %meh bullets.txt))
}
}
``````
Daking   -  Dec 19, 2010

thnx Jethro o
thats a whole new look on things for me
i really learned a LOT here...
thnx for tinyfying...

i still dont get the swap tho with the adress and the wildsite
pls explain whats the difference

im learning from a textbook and have not seen this \$wildsite before

Jethro   -  Dec 19, 2010

This:> on :PART:#: {
var %meh = [ %Rem ] \$+ bullets.txt
if (\$read(bullets.txt, w, %meh) == \$null) { halt }
else { /write -ds %meh bullets.txt }
}
on
:QUIT: {
var %meh = [ %Rem ] \$+ bullets.txt
if (\$read(bullets.txt, w, %meh) == \$null) { halt }
else { /write -ds %meh bullets.txt }
}
on *:NICK:{
var %meh = [ %Rem ] \$+ bullets.txt
if (\$read(bullets.txt, w, %meh) == \$null) { halt }
else { /write -c %meh \$newnick }
}Can rewrite to this:

``````on *:PART:#:bulletss
on *:QUIT:bulletss
on *:NICK:bulletss
alias -l bulletss {
var %Rem = \$remove(\$wildsite,\$chr(64),\$chr(33),\$chr(42),.users.omerta))
var %meh = [ %Rem ] \$+ bullets.txt
/write \$+(-,\$iif(\$event == nick,c \$newnick,ds %meh bullets.txt))
}
``````

``````var %i = \$remove(\$8,\$chr(44))), %j = %i / \$4, %k = \$calc((\$4 / 100) * 1), %l = \$calc(%i / (\$4 + %k))