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 as you please

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 10bought11 $4 10bullets for5 $ $+ $round(%l,0) 10per bullet. 4(With Hammer) }
  if ($round(%j,0) == %j) { msg $chan 7 $nick 10bought11 $4 10bullets for5 $ $+ %j 10per bullet. 5(No Hammer) }
  /notice $nick you will be reminded when you can buy new bullets
  var %Rem = $remove($address($nick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
  var %meh = [ %Rem ] $+ bullets.txt
  /write %meh $nick | /write bullets.txt %meh
  /timer 1 3600 /bullets $chan %meh
}
alias bullets {
  var %t = $read($2, 1)
  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 %Rem = $remove($address($nick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
  var %meh = [ %Rem ] $+ bullets.txt
  if ($read(bullets.txt, w, %meh) == $null) { halt }
  else { /write -ds %meh bullets.txt }
}
on *:QUIT: {
  var %Rem = $remove($address($nick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
  var %meh = [ %Rem ] $+ bullets.txt
  if ($read(bullets.txt, w, %meh) == $null) { halt }
  else { /write -ds %meh bullets.txt }
}
on *:NICK:{
  var %Rem = $remove($address($newnick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
  var %meh = [ %Rem ] $+ bullets.txt
  if ($read(bullets.txt, w, %meh) == $null) { halt }
  else { /write -c %meh $newnick }
}

Comments

Sign in to comment.
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.

 Respond  
_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
  if ($read(bullets.txt,w,%meh)) {
    /write $+(-,$iif($event == nick,c $newnick,ds %meh bullets.txt))
  }
}
 Respond  
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

 Respond  
Jethro   -  Dec 19, 2010

This:> on :PART:#: {
var %Rem = $remove($address($nick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
var %meh = [ %Rem ] $+ bullets.txt
if ($read(bullets.txt, w, %meh) == $null) { halt }
else { /write -ds %meh bullets.txt }
}
on
:QUIT: {
var %Rem = $remove($address($nick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
var %meh = [ %Rem ] $+ bullets.txt
if ($read(bullets.txt, w, %meh) == $null) { halt }
else { /write -ds %meh bullets.txt }
}
on *:NICK:{
var %Rem = $remove($address($nick,2),$chr(64),$chr(33),$chr(42),.users.omerta))
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
  if ($read(bullets.txt,w,%meh)) {
  /write $+(-,$iif($event == nick,c $newnick,ds %meh bullets.txt)) 
}

You save about 400 bytes.

And you can set all your local vars horizontally as such:

var %i = $remove($8,$chr(44))), %j = %i / $4, %k = $calc(($4 / 100) * 1), %l = $calc(%i / ($4 + %k))
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.