mIRC Home    About    Download    Register    News    Help

Print Thread
#217585 17/01/10 03:03 PM
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
Code:
on *:input:#: {
  if ( %talker == aan ) { set %talker1 aan }
  if ( %talker == uit ) { Return }
  If ( $left($1,1) == / ) { Return }
  If ( $left($1,1) == ! ) { Return }
  if ($chan == #help) { goto end }
  if ($chan == #speelpaleisje) { goto end }
  if ($chan == #koffiehoek) { goto end }
  if ($chan == #triviant-nederland-belgie) { goto end }
  if ($chan == #connecting-people) { goto end }
  if ($chan == #MP3) { goto end }
  if ($chan == #help-scripts) { goto end }
  inc %teller
  set %cool.input $1-
  unset %col.output
  unset %cool.output
  unset %coool.output
  unset %cooool.output
  unset %coooool.output
  unset %cooooool.output
  set %cool.tok
  goto cool
  :cool
  inc %cool.tok 1
  if ($gettok(%cool.input,%cool.tok,32) == $null) { goto coolsay }
  Set %col.output %col.output 04,01 $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
  Set %cool.output %cool.output 07,01 $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
  Set %coool.output %coool.output 08,01 $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
  Set %cooool.output %cooool.output 09,01 $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
  Set %coooool.output %coooool.output 11,01 $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
  Set %cooooool.output %cooooool.output 11,01 $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
  goto cool
  :coolsay
  set %len $len($1-)
  if (%talker1 == aan) { /msg $active 07,01! %col.output 07,01< $+ $left(%teller,1) $+ $mid<%teller,2,-1) $+ $right(%teller,1)) $+ 07,01> | /set %talker1 uit | /set %talker2 aan | halt }
  if (%talker2 == aan) { /msg $active 08,01! %cool.output 08,01< $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1)) $+ 08,01> | /set %talker2 uit | /set %talker3 aan | halt }
  if (%talker3 == aan) { /msg $active 09,01! %coool.output 09,01< $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1)) $+ 09,01> | /set %talker3 uit | /set %talker4 aan | halt }
  if (%talker4 == aan) { /msg $active 03,01! %cooool.output 03,01< $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1)) $+ 03,01> | /set %talker4 uit | /set %talker5 aan | halt }
  if (%talker5 == aan) { /msg $active 12,01! %coooool.output 12,01< $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1)) $+ 12,01> | /set %talker5 uit | /set %talker1 aan | halt }
  :end
}

menu channel,query {
  -
  Talker
  .Aan:set %talker aan | echo Talker Is Aangezet
  .Uit:set %talker uit | echo Talker is Uitgezet
}


Hi, this talker won't change his variables. After a msg it has to set %talker1 to "uit" and %talker2 "aan". After a new msg it has to set %talker2 to "uit" and %talker3 "aan".

But it wont work, anyone see the problem?


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Did you set %talker to aan before starting? And make sure that %talker isn't equal to uit.

Also, you can save a lot of code by just making your "cool" variables be color codes since the rest of the line is the same for all of them. For that matter, you could probably get rid of those variables altogether.

Beyond that, all your if ($chan == ....) stuff can be placed into single line using || (OR) and then use RETURN instead of GOTO.

Code:
if ($chan == #chan1 || $chan == #chan2 || $chan == #chan3) { return }


Invision Support
#Invision on irc.irchighway.net
Joined: Nov 2009
Posts: 117
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
Any snippet of that length that has that many /set variables, goto jumps and halts is already in trouble.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Here's just a small rewrite for you. It's untested, but just condenses what you have to make it easier to work with. Note that I just used $istok instead of || in the channel check to make it even shorter.

Code:
on *:input:#: {
  if ( %talker == aan ) { set %talker1 aan | set %talker2 uit | set %talker3 uit | set %talker4 uit | set %talker5 uit }
  if (%talker == uit || $left($1,1) == / || $left($1,1) == ! || $ctrlenter) { Return }
  if ($istok(#help #speelpaleisje #koffiehoek #triviant-nederland-belgie #connecting-people #MP3 #help-scripts,$chan,32)) { return }
  inc %teller
  set %cool.input $1-
  var %cool.tok = 1
  var %col1 = 04,01 , %col2 = 07,01 , %col3 = 08,01 , %col4 = 09,01 , %col5 = 11,01
  var %col = $findtok(%talker1 %talker2 %talker3 %talker4 %talker5,aan,32)
  while ($gettok(%cool.input,%cool.tok,32) != $null) {
    set %cool.output %cool.output $eval($+(%,col,%col),2) $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
    inc %cool.tok
  }
  var %col1 = 07,01 , %col2 = 08,01 , %col3 = 09,01 , %col3 = 09,01 , %col5 = 12,01
  var %color = $eval($+(%,col,%col),2)
  say %color $+ ! %cool.output %color $+ < $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1) $+ %color $+ >
  set %talker $+ %col uit
  set %talker $+ $iif(%calc(%col + 1 < 6),$v1,1) aan
}

menu channel,query {
  -
  Talker
  .Aan:set %talker aan | echo Talker Is Aangezet
  .Uit:set %talker uit | echo Talker is Uitgezet
}


As a note, I have no idea what you're trying to do with %teller. %teller is a number, so $left(%teller,1) doesn't really make sense and neiter does $mid with it. Perhaps you're trying to do something else here?


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
Well, the %teller should count the total lines I've messaged sinds the script has been loaded. Works fine, don't know if there's anything wrong with it.

The script gave a few small errors, but those I could fix.
I've added an halt and an unset at:

Code:
say %color $+ ! %cool.output %color $+ < $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1) $+ %color $+ >
  set %talker $+ %col uit
  set %talker $+ $iif(%calc(%col + 1 < 6),$v1,1) aan


Now it doens't do this anymore:
18.21.54 <@DJ-Serv> ! test <33>
18.21.54 <@DJ-Serv> test

And this:
18.22.13 <@DJ-Serv> ! lol test lol hoi test hoi lol smile test test hoi lol oke test <37> (It msg'ed my older lines too because it didn't unset anything or what ever.)

Just the problem now is that it still won't chang te colors, they still are just orange


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Put an echo before the /say line:

echo -a %color test

See if that shows in the correct color (might have to type a few lines).

Also, do you have any other script that changes text colors?


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
The echo just shows "test". Further nothing.

And I've only loaded that script


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, change the echo line to:

echo -a %color test : Talkers %talker1 %talker2 %talker3 %talker4 %talker5 : Col %col

Then try it a few times and see what echoes and let me know. I am at work and can't directly test myself, but if you can give me the echo, it will give me an idea where to look.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
7,1 test : Talkers aan uit uit uit uit : Col 1


That's what it is showing everytime.
(Stays 7,1)

Last edited by DuXxXieJ; 19/01/10 02:10 PM.

Squee whenever a squee squee's. Squee whenever a squee does not squee.
Joined: Jan 2007
Posts: 280
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
Mmh, I've forgotten there was a $rand identifer. This is the script now:

Code:
on *:input:#: {
  if (%talker == aan) { set %talker1 aan | set %talker2 uit | set %talker3 uit | set %talker4 uit | set %talker5 uit | set %talker6 uit }
  if (%talker == uit || $left($1,1) == / || $left($1,1) == ! || $ctrlenter) { Return }
  if ($istok(#help #speelpaleisje #koffiehoek #triviant-nederland-belgie #connecting-people #MP3 #help-scripts,$chan,32)) { return }
  inc %teller
  set %cool.input $1-
  set %cool.color $rand(2,14)
  var %cool.tok = 1
  var %col1 =  $+ %cool.color $+ ,01
  var %col = $findtok(%talker1 %talker2 %talker3 %talker4 %talker5,aan,32)
  while ($gettok(%cool.input,%cool.tok,32) != $null) {
    set %cool.output %cool.output $eval($+(%,col,%col),2) $+ $left($Gettok(%cool.input,%cool.tok,32),1)) $+ 00,01 $+ $mid($Gettok(%cool.input,%cool.tok,32),2,99)
    inc %cool.tok
  }
  var %col1 =  $+ %cool.color $+ ,01
  var %colorr = $eval($+(%,col,%col),2)
  say  $+ %cool.color $+ ,01 $+ ! %cool.output %colorr $+ <00 $+ $left(%teller,1) $+ $mid(%teller,2,-1) $+ $right(%teller,1) $+ $+ %colorr $+ >
  set %talker $+ %col uit
  set %talker $+ $iif(%calc(%col $+ 1 < 6),$v1,1) aan
  unset %cool.output
  unset %cool.color
  halt
}

menu channel,query {
  -
  Talker
  .Aan:set %talker aan | echo Talker Is Aangezet
  .Uit:set %talker uit | echo Talker is Uitgezet
}


I think the problem is solved now.


Squee whenever a squee squee's. Squee whenever a squee does not squee.

Link Copied to Clipboard