Serve

By KilllerX on Oct 06, 2011

something quick I threw together as a serve bot.

It serves cookies, cake, pie, or tea to a person that is in the room. If someone asks about it !serve help will bring up the info on it.

To make sure it works correctly in your mirc chat type

//echo -a $mircdir

go into that file. Make a folder called serve. and the files named pie, cake, cookie, tea, and random serve.

[how my randomserve.txt looks]
goes and gets a slice of $read(serve/pie.txt) Pie for $2 $+ .
goes and gets a cup of $read(serve/tea.txt) tea for $2 $+ .
goes and gets a slice of $read(serve/cake.txt) cake for $2 $+ .
goes and gets a $read(serve/cookie.txt) Cookie for $2 $+ .

It also checks to see if $2 (if pie/cookie/cake/tea is not $2) is in the room, and if one of them is it checks if $3 is in the room, if not replying that they can't serve that person.

If you want to add more, items like Alcohol, or meals. Make sure when you add it to

if ($2 == [item] ) if you want it to be random that you make a file with the items kinds.
ex.

if ($2 == alcohol) { describe # goes and gets a $read(serve/alcohol.txt) and gives it to $3 $+ . }

that you make a file under the folder serve/ called alcohol.txt and that you add different kinds of alcohol to it.

also add the line
goes and gets a $read(serve/alcohol.txt) and gives it to $2 $+ .

to the randomserve.txt so that it can be served randomly.

(Note I only had about 3 kinds of items in each, but make sure to come up with your own kinds of teas cakes pies and cookies)

thrown together in about 3 minutes. (and tested and it works)

On *:TEXT:!Serve*:#: {
    If (!%f.serve) {  
      if (!$3 && $2 !== help) {
        if ($2 ison #) { describe # $read(serve/randomserve.txt) | inc -z %f.serve 10 }
      }
      elseif ($2 == help) { msg # the items you can serve are. pie, tea, cake, cookie. 
        .timerserve1 1 5 Msg # to activate type !serve [one of the items] [name] 
        .timerserve2 1 5 msg # alternatively you can just type !serve [name] to serve a random thing to them.
        .timerserve3 1 5 msg # Please note you cannot serve a random name like !serve billybob3211234 (unless that name is in the room).
        inc -z %f.serve 20
      }
      else { 
        if ($3 ison #) {
          if ($2 == Pie) { describe # goes and gets a slice of $read(serve/pie.txt) Pie for $3 $+ . | inc -z %f.serve 10  }
          if ($2 == Tea) { describe # goes and gets a cup of $read(serve/tea.txt) tea for $3 $+ . | inc -z %f.serve 10  }
          if ($2 == Cake) { describe # goes and gets a slice of $read(serve/cake.txt) cake for $3 $+ . | inc -z %f.serve 10 }
          if ($2 == Cookie) { 
            var %cookieserve $rand(1,2)
            if (%cookieserve == 1) { msg # sorry $3 $+ , $nick tried to get you a cookie, but Cookie Monsta came in and stole it and he was all  "Nom nomnomss"  on it. }
            if (%cookieserve == 2) { describe # goes and gets a $read(serve/cookie.txt) Cookie for $3 $+ . | inc -z %f.serve 10 }
          }
          else { msg # Sorry $nick $+ , I can't serve someone who isn't here }
        }
      }
  }
}

Comments

Sign in to comment.
KilllerX   -  Mar 29, 2012

updated with less unnecessary checks. Also incorperated my Cookie mosnter stealing your cookie idea. Tested and works

 Respond  
KilllerX   -  Oct 07, 2011

something I tried under

If ($2 == Cookie) {
var %cookie = $rand(1,2)
if (%cookie = 1) { msg # sorry $3 $+ , but cookie monster stole your cookie, and he went "Om-nom-nom-nom" on it. }
if )%cookie = 2) { describe # goes and gets a $read(serve/cookie.txt) Cookie for $3 $+ . }
}

i also tried it with Goto $(1,2)
:1
:2

or even
set %cookie $rand(1,2)

None of them made it display properly. I would do the trigger
!serve cookie (name)

and the bot wouldn't even reply. the bot replied on the other 3 items, but not cookie. I would like to work that in there.

 Respond  
Jethro   -  Oct 07, 2011

jaytea's just about covered everything, including the redundancy I was saying.

 Respond  
jaytea   -  Oct 07, 2011
else ($2 !ison #) && ($2 !== help) {
[ ... ]
Else ($3 !ison #) {

these two lines are incorrect, and will result in a '($2 Unknown command' and '($3 Unknown command' if those else cases are reached.

'else' doesn't take a condition, and you shouldn't need to include one if you use proper if / elseif branching logic above it. for example:

  if ($2 ison #) { }
  if ($2 == help) { }
  else { }

the 'else' here applies only to the second if ($2 == help). this is the logic you're aiming for:

if ($2 ison #) { }
else {
  if ($2 == help) { }
  else { }
}

which is equivalent to:

if ($2 ison #) { }
elseif ($2 == help) { }
else { }

take a look at /help /if because these are basic fundamentals

 Respond  
KilllerX   -  Oct 06, 2011

I was thinking it was along that lines.

=== is case sensitive

I knew that != and !== were the same thing. So I guessed that !=== is case sensitive for it not being that. Just good to know that I was correct on that matter. And for some reason when I didn't have the double check. it replied with the "serve" and it replied also "that I can't serve a person that isn't in the room" not sure why it happened. But that is why I included the double check.

The Network I as for a bot as sometimes comes up with weird things for me to turn into a command, and more recently I am getting better at making them. I should expand my knowledge into some Regex, and some socketing.

(Before I added the double check and was testing)
[16:02] <16:02:30> <14Op:2theremained> !serve Laneshiftisback
06[16:02] * @killlerx goes and gets a cup of Sweet tea for .. [forgot to edit the random serve to show $2 rather then $3 and remove a period.]
01[16:02] <@killlerx> I can not serve something to someone who isn't here.

So I see that it showed both the serve and the ideal that he couldn't serve, even though the person was in. But when I added the double check.

[16:05] <16:05:16> <14Op:2theremained> !serve laneshiftisback
06[16:05] * @killlerx goes and gets a slice of Stawberry Pie for laneshiftisback.

It didn't reply that (in this case) laneshiftisback, wasn't in the room.

Again, not sure what is wrong but I know my coding was correct, but it still came up with those.

 Respond  
blackvenomm666   -  Oct 06, 2011

ahh yes i forgot about that haha thanks for the refresher jeth:)

 Respond  
Jethro   -  Oct 06, 2011

If you put an additional = as in !=== it becomes case sensitive. Just for your info. ^^

 Respond  
blackvenomm666   -  Oct 06, 2011

yes i am sure it works killerx and i was not trying to put you down was just an fyi:)

 Respond  
Jethro   -  Oct 06, 2011

Also, One check for $2 and $3 ison $chan is enough than repeating it the second time around. Keep up the good one, KillerX.

 Respond  
KilllerX   -  Oct 06, 2011

well may not need it, but it works.

 Respond  
blackvenomm666   -  Oct 06, 2011
($2 !== help)

you don't need both of the ='s in there

($2 != help)
 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.