mIRC Home    About    Download    Register    News    Help

Print Thread
#133624 23/10/05 03:38 AM
Joined: Oct 2005
Posts: 6
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Oct 2005
Posts: 6
I am try to have a simple yes or no PM if you can inderstand what I mean. For example,
When I type in ihelp I get a message from my bot asking questions that you simply respond yes or no to...
<bot> Do you like the chan?
<me> yes
<bot> Thank you for taking time in this servey!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is what I have Completed:
on *#:TEXT:ihelp:#: {
msg $nick So you need help, $nick $+ ? Please ask them here and I’ll try to help! Have a problem or want some info on RCT3 and RCT3 CrAzY? Please ask them in COMPLETE detail! Thanks!

Any help is appreciated! Thanks!

#133625 23/10/05 05:52 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Something I wrote up just now..

I didn't put all too much thought into it, so it's a bit messy.

Code:
on *:text:survey me:#: {
  var %file = questions.txt , %minutes = 5 , %duration = $duration($calc(%minutes * 60))
  if (!$istok(%survey,$nick,32)) {
    set %survey %survey $nick
    set %sq. [ $+ [ $nick ] ] 1
    if ($isfile($+(sqa.,$nick,.txt))) { remove $+(sqa.,$nick,.txt) }
    .msg $nick You will have %duration to complete this survey.
    .timer 1 $calc(%minutes * 60) remove.sq $nick
    .msg $nick Answer the follow questions with a yes or no answer.
    .msg $nick Question #1: $read(%file,1)
  }
  else { 
    .msg # Sorry, $nick $+ , your survey is already in progression. $&amp;
      Please check your messages, and reply to the questions with a simple, $&amp;
      yes or no.
  }
}

on *:text:*:?: {
  var %a = $1 , %file = questions.txt
  if ($istok(%survey,$nick,32)) {
    if (%a == yes || %a == no) {
      write sqa. $+ $nick $+ .txt $+($chr(35),%sq. [ $+ [ $nick ] ],:) $lower(%a)
      inc %sq. $+ $nick
      if ($read(%file,%sq. [ $+ [ $nick ] ])) {
        .msg $nick Question $+($chr(35),%sq. [ $+ [ $nick ] ],:) $v1
      }
      else {
        .msg $nick Survey is now finished. Thank you for your time.
        remove.sq $nick
      }
    }
    else {
      .msg $nick Invalid Answer.
    }
  }
  else {
    .msg $nick You are not currently in a survey session.
  }
}
alias remove.sq {
  var %nick = $1
  if ($istok(%survey,%nick,32)) { set %survey $remtok(%survey,%nick,32) }
  if ($var(sq. [ $+ [ %nick ] ])) { unset %sq. [ $+ [ %nick ] ] }
}


You'd make a questions.txt file, and drop it into your mIRC dir, and then populate the file with questions.

Your bot would sit in a channel, someone would type:

survey me

And then the bot would message them. Hope this helps you out, feel free to breakdown the code and use the bits you need.

Last edited by Rand; 23/10/05 05:55 AM.
#133626 23/10/05 06:32 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Decided to slightly re-write it, along with add a few additional notes.

questions.txt should go in your mIRC dir.

Within questions.txt, you can format how you want the questions to be displayed. ie, first line would read:
Question #1: Do you enjoy taking surveys?

It would message the person that, when a person types "survey me" in the same channel that the bot is in.

I'm not exactly sure how you wanted the information saved, so I decided to use /write. and the users answers would be in text files like: sqa.$nick.txt.

Here's the cleaned up code:

Code:
on *:text:survey me:#: {
  var %file = questions.txt , %minutes = 5 , %duration = $duration($calc(%minutes * 60))
  if (!%survey. [ $+ [ $nick ] ]) {
    set $+(-u,$calc(%minutes * 60)) %survey. [ $+ [ $nick ] ] 1
    if ($isfile($+(sqa.,$nick,.txt))) { .remove $+(sqa.,$nick,.txt) }
    .msg $nick You will have %duration to complete this survey. Answer the $&amp;
      following questions with a yes or no answer.
    .msg $nick $read(%file,1)
  }
  else { 
    .msg # Sorry, $nick $+ , your survey is already in progression. $&amp;
      Please check your messages, and reply to the questions with a simple, $&amp;
      yes or no.
  }
}

on *:text:*:?: {
  var %a = $1 , %file = questions.txt
  if (%survey. [ $+ [ $nick ] ]) {
    var %q = $v1
    if (%a == yes || %a == no) {
      write $+(sqa.,$nick,.txt) $+($chr(35),%q,:) $lower(%a)
      inc %survey. [ $+ [ $nick ] ]
      if ($read(%file,%survey. [ $+ [ $nick ] ])) {
        .msg $nick $v1
      }
      else {
        .msg $nick Survey is now finished. Thank you for your time.
        unset %survey. [ $+ [ $nick ] ]
      }
    }
    else {
      .msg $nick Invalid Answer.
    }
  }
}


Anyway, good luck.

#133627 23/10/05 06:54 AM
Joined: Oct 2005
Posts: 6
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Oct 2005
Posts: 6
I tried doing what you told me to do but this still won't work. Do you think it is becuase of the { and } i don't think it is nessary is it? anyway thanks for your help.

#133628 23/10/05 07:00 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Umn, the {'s and }'s should not be a problem. I made this by testing it.

Does it give any errors?

Basically, you should have a questions.txt file in your mIRC dir, You should have atleast 1 question in the questions.txt file.

Once you're in the same channel that the bot is in, you would type in the channel:
survey me

The bot should then message you, telling you the time limit, and asking you the first question within the questions.txt file.

Also, this script probably only works with mIRC 6.16, so make sure your mIRC client is up to date.

#133629 23/10/05 07:05 AM
Joined: Oct 2005
Posts: 6
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Oct 2005
Posts: 6
I am still having problems. It says there are no errors, well actually it says nothing. I have loaded my questions.txt in my mIRC dir and yes i do have version 6.16. What do i do?

#133630 23/10/05 07:16 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Okay lesse..

Try replacing the on *:text:survey me:#: { }

with this, and tell me what it says in your bots status window:

Code:
on *:text:survey me:#: {
  var %file = questions.txt , %minutes = 5 , %duration = $duration($calc(%minutes * 60))
  if ($isfile(%file)) {
    echo -stg The file %file does exist. The first line reads as:
    echo -stg $read(%file,1)
  }
  if (!%survey. [ $+ [ $nick ] ]) {
    echo -stg The survey variable does not exist for this nick
    set $+(-u,$calc(%minutes * 60)) %survey. [ $+ [ $nick ] ] 1
    echo -stg Created Variable, contents are as follows: %survey. [ $+ [ $nick ] ]
    if ($isfile($+(sqa.,$nick,.txt))) { .remove $+(sqa.,$nick,.txt) }
    .msg $nick You will have %duration to complete this survey. Answer the $&amp;
      following questions with a yes or no answer.
    .msg $nick $read(%file,1)
  }
  else { 
    .msg # Sorry, $nick $+ , your survey is already in progression. $&amp;
      Please check your messages, and reply to the questions with a simple, $&amp;
      yes or no.
  }
}

#133631 23/10/05 07:26 AM
Joined: Oct 2005
Posts: 6
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Oct 2005
Posts: 6
The code still dosen't work and the bot's status window is normal.

#133632 23/10/05 07:37 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Do you have another on text event in the same script file?

Cause it *should* trigger atleast the on text event.

If there is two on text events, that use the :#: in the same file, the last one will not be read, if I remember correctly, so maybe that's the issue..

Otherwise, this code should work perfectly fine.


Link Copied to Clipboard