User Control Panel
Advertisements

HELP US, HELP YOU!

making a command

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Ideas
View unanswered posts
Author Message
malefactor
Member
Member


Joined: 27 Jan 2005
Posts: 109
Location: Lewiston, ME
Reputation: 17.7Reputation: 17.7

PostPosted: Mon Jan 31, 2005 11:37 pm    Post subject: Reply with quote

I want to create a command that says something, and then waits for a specific response before passing controll back to the bot.

Does anyone have any idea how to do this? Is it even possible?
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Tue Feb 01, 2005 12:00 am    Post subject: Reply with quote

You need to give more details in your posts.

Do you want the bot to say something just to you or to everyone? To you want it to wait for a response only from you or from anyone? Is the bot supposed to be in this "suspended" state for everyone or just for you?

In any case, this is all very possible. Simply set a state variable. If the state variable is set to one value, it works normally, if set to a different value, it only responds to a given message. You always want to let the bot maintain control (never use sleep, for example), but "seem" like it is suspended by only responding to a particular message.
Back to top
malefactor
Member
Member


Joined: 27 Jan 2005
Posts: 109
Location: Lewiston, ME
Reputation: 17.7Reputation: 17.7

PostPosted: Tue Feb 01, 2005 12:16 am    Post subject: Reply with quote

sorry, just want to do this inside of a command, so that whoever runs the command, will then have to type something specific, like yes or no, before moving on.

I'd like to avoid having to code the on_im handler to check the state of that variable, then check the screenname of the person who just typed, and then decide what to do based on that.
Back to top
Xyem
Young One
Young One


Joined: 03 Jan 2005
Posts: 54

Reputation: 17.4Reputation: 17.4

PostPosted: Tue Feb 01, 2005 1:39 am    Post subject: Reply with quote

He basically means the same sort of thing as when you run a template bot for the first time and it asks for your settings (like MayaBot4) but he wants it inside a command. Must admit, it would be very useful...
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Tue Feb 01, 2005 2:08 am    Post subject: Reply with quote

QUOTE(malefactor @ Jan 31 2005, 04:16 PM)
I'd like to avoid having to code the on_im handler to check the state of that variable, then check the screenname of the person who just typed, and then decide what to do based on that.

You can't avoid everything or else there'd be no point in programming. Razz

You can easily accomplish this by maintaining a hash that stores the state of each user. (Better yet, use a database). I do something similar when new users use my bots. I require them to read a short agreement and then type "I agree" before they can continue.

Somewhere in your message handler, you would have something like this:

Code:
my $state = $statehash->{$username} || 0;<br /><br />if( $state == 99 )<br />{<br />  if( $message eq 'yes' )<br />  {<br />     $statehash->{$username} = 0;<br />     # do whatever you want now that they answered yes<br />  }<br />  else<br />  {<br />      # do whatever, tell them they have to say yes?<br />  }<br />}<br />else<br />{<br />  # normal code<br />}


And you would have some code that gets them into state 99.
Back to top
malefactor
Member
Member


Joined: 27 Jan 2005
Posts: 109
Location: Lewiston, ME
Reputation: 17.7Reputation: 17.7

PostPosted: Tue Feb 01, 2005 2:33 am    Post subject: Reply with quote

thanks

guess I'll have to build a few commands right into the handler, unless I can think of another way...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Ideas All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group