Starting of a bot

By Epic on Jun 25, 2011

Got bored and made a starting of a "cash" themed bot, something similar to some cashbots in swiftirc network iv seen, not as complex or complete, and not made to be some sort of a clone of any such bots.

this is just a basic idea/way to go about doing a couple commands cash related that I thought some hawkee members in need of a project could do

to use:
put into a remote
make a cash.txt file for messages on how you get the cash
edit the sloppy code :p

on $*:TEXT:*:#: {
  if ($regex($1,/^[!.@](cash)/Si)) {
    if (!$hget(cash,$nick)) {
      var %output $iif($left($1,1) == @,.msg #,.notice $nick)
      var %cash $r(100,1000)
      var %timeleft $r(300,500)
      var %msg $read(cash.txt)
      var %newcash $calc($readini(cash.ini,$nick,cash) + %cash)
      %output $nick %msg $ $+ %cash $+ , $nick now has $ $+ %newcash
      hadd -mz cash $nick %timeleft
      writeini -n cash.ini $nick cash %newcash
    else {
      .notice $nick you still need to wait $duration($hget(cash,$nick))
  if ($regex($1,/^[!.@](lot)/Si)) {
    if ($readini(cash.ini,$nick,cash) < 100) { .notice $nick you need at least $100 to buy a lot | halt }
    if (!$hget(lot,$nick)) {
      var %go $r(1,10)
      var %output $iif($left($1,1) == @,.msg #,.notice $nick)
      var %pmoney $readini(cash.ini,$nick,cash)
      writeini -n cash.ini $nick cash $calc(%pmoney - 100)
      var %lot $readini(cash.ini,lot,amnt)
      if (%go != 10) {
        var %left $calc(%pmoney - 100)
        %output $nick buys a lot for $ $+ 100 but loses, $nick now has $ $+ %left left. The Pot now contains $ $+ %lot
        hadd -mz lot $nick $r(1200,2400)
      elseif (%go == 10) {
        var %m $calc(%pmoney + %lot)
        %output $nick buys a lot for $100 and wins the lottery and the pot containing %lot $+ , $nick now has %m
        writeini cash.ini $nick cash %m
        writeini cash.ini lot amnt $r(1000,2000)
        hadd -mz lot $nick $r(1200,2400)
    else { 
      .notice $nick you still need to wait $duration($hget(lot,$nick)) to buy another lot


Sign in to comment.
Epic   -  Jul 04, 2011

tbh squabbles comparing scripting pricks is abit annoying, i understand progressive criticism, and welcome it, but saying, i could do this in less lines, or that, just doesnt have a point

napalm`   -  Jul 03, 2011

If I were a young, more smug version of my self, I would code a socket bot that did everything this does in less lines and without the need of a separate mIRC. Unfortunately for the community, I am no longer THAT big of a prick.

Epic   -  Jul 03, 2011

nap: just my style of doing things when its not really an issue using regml or anything, add most simple bots can be used in an mirc itself w/ this loaded in the remote, either on a vps or whatever. other languages i can see the need too but for simple/ my purposes just using this is sufficient, although if multiple mircs would need to be open for alot of bots i could see tht xd

napalm`   -  Jul 01, 2011

I was stepping through that code thinking "why is cash and lot in ()'s if he's not using regml? Good looking out napa182.

Also, a bot is not a second mIRC open with this snippet loaded in remotes. You need to either code a bot using mIRC sockets or an external app using any number of other programming languages.

Epic   -  Jun 27, 2011

lol nah, iv seen a couple bots with this theme, onzinch, cashbot, unogame, so got bored and make a simple 2 command script people can work off of xd

Bielie   -  Jun 26, 2011

also making onzichtbaar now :)?

Epic   -  Jun 25, 2011

oh didnt know $regml worked like that :o always used it as the trigger(cash|lot), not the @!., good to know tho, thanks :)

napa182   -  Jun 25, 2011

If you are going to use regex in your on text events you may as well use $regml()
you could do where $regml(1) would be ! or . or @ and $regml(2) would be cash or lot.

on $*:TEXT:/^([!.@])(cash|lot)\b/iS:#: {

then on ur

$iif($left($1,1) == @,.msg #,.notice $nick)

change it to

$iif($regml(1) = @,.msg #,.notice $nick)

keep at it..

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.