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
}
}
}
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
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.
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..