mIRC Home    About    Download    Register    News    Help

Print Thread
#258774 27/08/16 11:12 PM
Joined: Sep 2015
Posts: 33
D
Deerayn Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Sep 2015
Posts: 33
Hi, so I have a problem, and need some help.

So I made this, bot picks random user from chat and write something to him, my question is how to make that bot would wait for user response.
For example:
Bot: User <text from file a1>
Waiting for User response...
User: text
Bot: <text from file a2>

Quote:
on $*:text:/^(\S+)/:#:{
if ((%floodrandomk) || ($($+(%,floodrandomk.,$nick),2))) { return }
set -u4 %floodrandomk On
set -u5 %floodrandomk $+ $nick On
set %randnick $nick($chan,$rand(1,$nick($chan,0))) {
msg $chan %randnick $read(a1.txt,n) } {
if ($nick = %randnick) msg $chan %randnick $read(a2.txt,n) } ; main problem is here
}

Joined: May 2016
Posts: 50
T
Babel fish
Offline
Babel fish
T
Joined: May 2016
Posts: 50
Code:
on $*:text:/^(\S+)/:#:{

 if ((%floodrandomk) || ($($+(%,floodrandomk.,$nick),2))) {
  return
 }

 set -u4 %floodrandomk On
 set -u5 %floodrandomk $+ $nick On
 set %randnick $nick($chan,$rand(1,$nick($chan,0))) {
  msg $chan %randnick $read(a1.txt,n) 
 }
 { 
  if ($nick = %randnick) {
   msg $chan %randnick $read(a2.txt,n) 
  }
}



Looks like you forgot to start the second if statement with a '{'

Next time use the CODE tags to show proper spacing of code, otherwise it looks messy. Not sure if this fixes your problem.

Last edited by TillableToast; 31/08/16 07:32 PM.

Life is potato.
Joined: Sep 2015
Posts: 33
D
Deerayn Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Sep 2015
Posts: 33
Well I get both answers instantly, I want that only if that user writes something he gets answer2

Joined: May 2016
Posts: 50
T
Babel fish
Offline
Babel fish
T
Joined: May 2016
Posts: 50
Thats to be expected

Code:
 set %randnick $nick($chan,$rand(1,$nick($chan,0))) {
  msg $chan %randnick $read(a1.txt,n) 
 }


Since you the the %randnick to be equal to the user that types which results in this if statement to be true

Code:
  if ($nick = %randnick) {
   msg $chan %randnick $read(a2.txt,n) 
  }


Therefore messages both answers


Life is potato.

Link Copied to Clipboard