mIRC Home    About    Download    Register    News    Help

Print Thread
Loop (Please Help) #72485 23/02/04 08:22 AM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
on *:TEXT:*#:{ if (%kaos.bot == yes) { search $strip($1-,c) } }
alias search { var %x = 1
while (%x <= $lines(answers.txt)) { if ($1- isin $read(answers.txt,%x)) { notice $nick $talker(Too late, Someone else got that answer!) }
if ($1- !isin $read(answers.txt,%x)) { search2 $strip($1-,c) }
inc %x
}
}
alias search2 { var %x = 1
while (%z <= $lines(%question)) { notice $nick $talker(Point Added!) | write answers.txt $1-
inc %x
}
}
--Variables--
%queston is: Eminem.txt
%kaos.bot is: yes
%left is: 12,1(
%text is: 15,1
%right is: 12,1)
Anyone see a problem with that?

Last edited by Kriminal; 23/02/04 09:34 AM.

Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72486 23/02/04 08:23 AM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
in the second one you have while %z <= ..., change z to x


New username: hixxy
Re: Loop. #72487 23/02/04 08:30 AM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
New(est) Code:
on *:TEXT:*:#Kaos:{ if (%kaos.bot == yes) { search $strip($1-,c) }
}
alias search { var %x = 1
while (%x <= $lines(answers.txt)) { if ($1- isin $read(answers.txt,%x)) { notice $nick $talker(Too late, Someone else got that answer!) }
if ($1- !isin $read(answers.txt,%x)) { search2 $strip($1-,c) }
inc %x
}
}
alias search2 { var %x = 1
while (%x <= $lines(%question)) { notice $nick $talker(Point Added!) | write answers.txt $1-
inc %x
}
}
--
--Still not working.

Last edited by Kriminal; 23/02/04 09:07 AM.

Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72488 23/02/04 09:53 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I think its working fine, I just doubt its doing what you want it to do.

What is it that you expected to happen when someone typed something.
Give maybe 3 or 4 examples with each producing differnt results.

Re: Loop. #72489 23/02/04 10:05 AM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
Say you said Bully in the channel
It's supposed to say: Blah blah you got it blah blah and write it in answers.txt
and say someone else tried to do it
It would msg the person with "Already Used" or something like that and wouldn't write it in answers.txt
~Krim


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72490 23/02/04 10:37 AM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
on *:TEXT:*:#Kaos:{ if (%kaos.bot == yes) { search $strip($1-,c) }
}
alias search { var %x = 1
while (%x <= $lines(answers.txt)) { if ($1- isin $read(answers.txt,%x)) { notice $nick $talker(Too late, Someone else got that answer!) }
if ($1- !isin $read(answers.txt,%x)) { search2 $strip($1-,c) }
inc %x
}
}
alias search2 { var %x = 1
while (%x <= $lines(Eminem.txt)) { if ($1- isin $read(Eminem.txt,%x)) { notice $nick $talker(Point Added!) | write answers.txt $1- }
inc %x
}
}
Updated;
I replaced %question with Eminem.txt to see
and I added a "if" statement in the search2 alias, still not working, Any clue why anyone? =/


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72491 23/02/04 10:46 AM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
i dont think $nick returns anything in an alias just in a remote, try settin the nick as a variable and calling that.


billythekid
Re: Loop. #72492 23/02/04 10:53 AM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
you are right, as soon as you leave the event, $nick has no value.

from the aliasses you can't use identifiers as $chan or $nick

best is to pass $nick as the first parameter...

here is a sample:
Code:
{ search $nick $strip($1-,c) }

alias search { var %x = 1
while (%x &lt;= $lines(answers.txt)) { if ($2- isin $read(answers.txt,%x)) { notice $1 $talker(Too late, Someone else got that answer!) }
if ($2- !isin $read(answers.txt,%x)) { search2 $1 $strip($2-,c) }
inc %x
}
}


If it ain't broken, don't fix it!
Re: Loop. #72493 23/02/04 11:13 AM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
Newest Update:
on *:TEXT:*:#Kaos:{ if (%kaos.bot == yes) { search $nick $strip($1-,c) }
}
alias search { var %x = 1
while (%x <= $lines(answers.txt)) { if ($2- isin $read(answers.txt,%x)) { notice $1 $talker(Too late, Someone else got that answer!) }
if ($2- !isin $read(answers.txt,%x)) { search2 $1 $strip($2-,c) }
inc %x
}
}
alias search2 { var %x = 1
while (%x <= $lines(Eminem.txt)) { if ($2- isin $read(Eminem.txt,%x)) { notice $1 $talker(Point Added!) | write answers.txt $2- }
inc %x
}
}

-What Works:
If the Answer is already in answers.txt (I put it in manually) The notice works. (Im sure the $nick wasn't the problem) - but it wont do search2 part.
~Krim

Last edited by Kriminal; 23/02/04 11:20 AM.

Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72494 23/02/04 11:22 AM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
Code:
 
alias search { var %x = 1
while (%x &lt;= $lines(answers.txt)) { 
if ($2- isin $read(answers.txt,%x)) { notice $1 $talker(Too late, Someone else got that answer!) }
[color:red]else[/color]if ( $2- !isin $read(answers.txt,%x)) { search2 $1 $strip($2-,c) } 
inc %x 
}
}
 
try that, i've had if / elseif problems before, i'd try it myself but im at work without mIRC atm ;o(
edit: sorry didnt read the whole post, shoot me ;oP

Last edited by billythekid; 23/02/04 11:26 AM.

billythekid
Re: Loop. #72495 23/02/04 11:27 AM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
on *:TEXT:*:#Kaos:{ if (%kaos.bot == yes) { search $nick $strip($1-,c) }
}
alias search { var %x = 1
while (%x <= $lines(answers.txt)) { if ($2- isin $read(answers.txt,%x)) { notice $1 $talker(Too late, Someone else got that answer!) }
elseif ($2- !isin $read(answers.txt,%x)) { search2 $1 $strip($2-,c) }
inc %x
}
}
alias search2 { var %x = 1
while (%x <= $lines(Eminem.txt)) { if ($2- isin $read(Eminem.txt,%x)) { notice $1 $talker(Point Added!) | write answers.txt $2- }
inc %x
}
}
Is what I tried
--This is quite frustrating cause I'm like, nearly 100%, my code should've worked from my 2nd-3rd fix. =/
--No work =/


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72496 23/02/04 06:52 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
You can try this
Code:
on *:TEXT:*:#Kaos:if (%kaos.bot == yes) { search $strip($1-,c) }
alias search {
  var %x = 1
  while (%x &lt;= $lines(answers.txt)) {
    if ($1- isin $read(answers.txt,%x)) { notice $nick Too late, Someone else got that answer! | return }
    inc %x 
  }
  search2 $strip($1-,c)
}
alias search2 {
  var %x = 1
  while (%x &lt;= $lines(Eminem.txt)) {
    if ($1- isin $read(Eminem.txt,%x)) { notice $nick Point Added! | write answers.txt $1- }
    inc %x
  }
}

Or this much shorter version
Code:
on *:TEXT:*:#Kaos:{
  if (%kaos.bot == yes) {
    if $read(answers.txt,wn,$+(*,$1-,*)) { notice $nick Too late, Someone else got that answer! }
    elseif $read(Eminem.txt,wn,$+(*,$1-,*)) { notice $nick Point Added! | write answers.txt $1- }
  }
}


Re: Loop. #72497 23/02/04 09:36 PM
Joined: Dec 2003
Posts: 199
K
Kriminal Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
Thanks a Bunch Iori, But, Can you tell me what it had to be right there for it to work "the Search2 part" had to be here:
inc %x
}
search2 $strip($1-,c)
}
I like understanding codes that I make that don't work and are fixed by someone. smile


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
Re: Loop. #72498 23/02/04 09:43 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well with that first code, I just copied what you had and only 'fixed' the part that wasn't working, which was the loop). That particular command could simply have been "search2 $1-"