Max's Botserv Dialog

By MaxEvans on May 08, 2009

Image

I originally made this specifically for the WyldRyde network, it works with their Botserv. It would probably work on other networks with Botserv as well. It's part of the script I'm building optimized for the WyldRyde network. =]

It's fairly simple to use, just add your channel(s) and choose a channel to operate Botserv on. Whichever channel you have selected, determines what channel the rest of the dialog operates on. You can list all the bots available, type in the name of the bot you want, and click assign, and it'll assign the bot to your channel. You can make the bot say something by using the bot talk section, and make the bot do something by using the bot act section. I also put in a confirm delete dialog for deleting channels.

I'll be adding stuff to it, I just finished this first version after working with it for a while and making changes to it.

Thanks to Kirby for helping with the drop down menu. =]

dialog BSD {
  title "Max's Botserv Dialog"
  size -1 -1 192 106
  option dbu
  box "Assign/Unassign Bot", 1, 8 7 85 38
  edit "", 2, 22 17 58 10
  button "Assign", 3, 16 30 32 9
  button "Unassign", 4, 51 30 32 9
  box "Bot Channel", 5, 8 46 85 35
  button "Add Channel", 7, 13 68 34 9
  button "Close", 8, 101 88 21 9, ok cancel
  button "List Bots", 9, 63 88 27 9
  box "Make The Bot Talk", 10, 97 7 88 38
  edit "", 11, 102 17 77 10, autohs
  button "Bot Say", 12, 123 30 32 9
  box "Make The Bot Do Something", 13, 97 46 88 35
  edit "", 14, 102 56 77 10, autohs
  button "Bot Act", 15, 123 68 32 9
  button "Del Channel", 16, 49 68 36 9
  combo 6, 18 55 63 50, size drop
}

on *:DIALOG:BSD:init:*:{
  didtok $dname 6 44 %BChannels
  did -c $dname 6 1
}

on *:dialog:BSD:sclick:*: {
  if ($did == 3) { /botserv assign $did(BSD,6).text $did(BSD,2) }
  if ($did == 4) { /botserv unassign $did(BSD,6).text }
  if ($did == 7) { set %BChannels $addtok(%BChannels,$?="Enter a channel to add.",44) }
  if ($did == 16) { set %BChannels $remtok(%BChannels,$did(6).seltext,1,44) }
  if ($did == 9) { /botserv botlist }
  if ($did == 12) { /botserv say $did(BSD,6).text $did(BSD,11) | did -r BSD 11 }
  if ($did == 15) { /botserv act $did(BSD,6).text $did(BSD,14) | did -r BSD 14 }
}

Comments

Sign in to comment.
MaxEvans   -  May 13, 2009

Thank you! That worked.

Now if I wanted to put

$iif($input(Delete Channel?,ywk5,Confirm Delete)

I put that in there and it said invalid format.

 Respond  
napa182   -  May 13, 2009

try this

$deltok(%BChannels,$did(6).sel,44)

or this

$remtok(%BChannels,$did(6).seltext,1,44)
 Respond  
MaxEvans   -  May 13, 2009

I tried

$deltok(%BChannels,$did(BSD,6).text,44)

But that didn't work. So, I'm wondering if I missed something. Or didn't do it right.

 Respond  
Cheiron   -  May 13, 2009

i had a look at mirc help files for deltok and this is all i could see

$deltok(text,N-N2,C)

Deletes the Nth token from text.

$deltok(a.b.c.d,3,46) returns a.b.d

$deltok(a.b.c.d,2-3,46) returns a.d

You can specify a negative value for N.

 Respond  
MaxEvans   -  May 11, 2009

What would I use to delete tokens? I tried $deltok, but I must be missing something.

 Respond  
MaxEvans   -  May 09, 2009

Yeah, I'll add a lot more to the dialog. I added basic commands for now.

 Respond  
Cheiron   -  May 09, 2009

looks nice and i might point out a first for me to se a dialouge made to access it..
now.. in saying that, botserv has much much more functions though than you have listed.
this is a complete list of botserv functions. you may for an upgrade to this code want to include some of these into the dialouge :)

-BotServ- BotServ allows you to have a bot on your own channel.
-BotServ- It has been created for users that can't host or
-BotServ- configure a bot, or for use on networks that don't
-BotServ- allow users' bot. Available commands are listed
-BotServ- below; to use them, type /msg BotServ command. For
-BotServ- more information on a specific command, type /msg
-BotServ- BotServ HELP command.

-BotServ- BOTLIST Lists available bots
-BotServ- ASSIGN Assigns a bot to a channel
-BotServ- SET Configures bot options
-BotServ- KICK Configures kickers
-BotServ- BADWORDS Maintains bad words list
-BotServ- ACT Makes the bot do the equivalent of a "/me" command
-BotServ- INFO Allows you to see BotServ information about a channel or a bot
-BotServ- SAY Makes the bot say the given text on the given channel
-BotServ- UNASSIGN Unassigns a bot from a channel -BotServ- Bot will join a channel whenever there is at least
-BotServ- 1user(s) on it.

gets a 7 from me so far as it stands due to its uniqueness

 Respond  
MaxEvans   -  May 09, 2009

I remembered I had used ini files before. But didn't think about using variables for it. So, that is a good idea. =P

 Respond  
Kirby   -  May 09, 2009

Along with what Slickone has said about using tokens, instead of .ini files, you can also change:

  if ($did == 7) { writeini BChannels.ini Channels $calc($ini(BChannels.ini,Channels,0) + 1) $?="Enter Channel To Add" }

to

  if ($did == 7) { set %BChannels $addtok(%BChannels,$?="Enter a channel to add.",44) }

I see that this is the complete snippet that you had a question about how to use .ini files, in the mIRC Forum. You could've used variables instead. :-P

 Respond  
Slickone   -  May 09, 2009

instead of useing BChannels.ini for the channels just use a var ex: %BChannels #chan1,#chan2,#chan3 also after that get rid of that ChannelBox alias then use this on the init event

didtok $dname 6 44 %BChannels

/help /didtok

 Respond  
Kirby   -  May 09, 2009

Looks nice, you're getting better at dialogs.

One thing I would change though:

dialog Confirm {
  title "Confirm Delete"
  size -1 -1 84 36
  option dbu
  box "Delete Channel?", 1, 3 1 78 33
  button "Yes", 2, 10 16 29 9, ok
  button "No", 3, 44 16 29 9, cancel
}

Instead of a separate dialog, you can use an $input event to handle that.

In this script, however, I would use something like:

noop $input(Delete Channel?,ywk5,Confirm Delete)

/noop means no operation, if you didn't know.
To further modify this, you can do something like:

$iif($input(Delete Channel?,ywk5,Confirm Delete),remini BChannels.ini Channels $did(BSD,6).sel)

/help $input for more information on how to use them.

 Respond  
Aucun50   -  May 09, 2009

I like this simple but useful, the coding is great as well.

I think you could have made the dialog look a bit better some of the buttons are a little to small for the words inside them.

 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.