mIRC Home    About    Download    Register    News    Help

Print Thread
S
s0tt0
s0tt0
S
Heres my script:
Code:
   if ($did(12).state == 1) {     
    if ($did(2, seltext) isalnum) {
      %g, %z, %r
      if ($did(8, seltext) isnum) { 
        set %r -r $did(8, seltext)
      }
      elseif ($did(6, seltext) isalnum) {
        set %g -g $did(6, seltext) 
      }
      elseif ($did(4, seltext) isalnum) {
        set %z -s $did(4, seltext) 
      }
      msg #mychannel !info %g %z %r $did(2, seltext)
    }
    else { 
      if ($did(2, seltext) isalnum) {
        msg #mychannel !info $did(2, seltext)
      }
    }
  } 

I want to make a script for all users in my channel, but I cant get it to work and i have problems with this code only. It should message an infoline in format !info -s <help section> -r <results> <searchstring> (e.g. !info -s channelhelp -r 10 i need help). It works but with only 1 paramater (if it shows -s then it wont show -r but i need them together and i have 5 parameters which you can use any way you like). Texts come from dialog boxes.. It's pretty confusing text but I'll hope someone will understand it and help me with it smile

TIA
s0tt0

Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Untested..

Code:
if ($did(12).state == 1) { 
  if ($did($dname,2).seltext isalnum) {
    %g, %z, %r
    if ($did($dname,8).seltext isnum) { 
      set %r -r $did($dname,8).seltext
    }
    elseif ($did($dname,6).seltext isalnum) {
      set %g -g $did($dname,6).seltext
    }
    elseif ($did($dname,4).seltext isalnum) {
      set %z -s $did($dname,4).seltext
    }
    msg #mychannel !info %g %z %r $did($dname,2).seltext
  }
  else { 
    if ($did($dname,2).seltext isalnum) {
      msg #mychannel !info $did($dname,2).seltext
    }
  }
} 

S
s0tt0
s0tt0
S
nop it doesnt work at all now. its not the did commands that are wrong but theres something with variables, becuse it doesnt display the variables alltogether

Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
Post in the code that you have, dialog, sclicks, inits etc. See if we can unveil it.

S
s0tt0
s0tt0
S
rest of the code works 100% i have problems only with this one. maybe you cant do it with variables or something...

Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
if ($did($dname,2).seltext isalnum) {
%g, %z, %r

There's your error.

This will evaluate the variable named "%g," to its value, and try to execute that value as a command, with the values of variables "%z," and "%r" as parameters passed to this supposed command.

10/1 says you don't have a variable named "%g," (that is with the comma in the name)

Greets

S
s0tt0
s0tt0
S
but still how can i fix it so it shows only those commands what i have chosen in dialog box from options?

I
Iori
Iori
I
Code:
  if ($did(12).state == 1) {
    if ($did(2).seltext isalnum) {
      var %a
      if ($did(8).seltext isnum) { %a -r $v1 }
      if ($did(6).seltext isalnum) { %a %a -g $v1 }
      if ($did(4).seltext isalnum) { %a %a -s $v1 }
      msg #mychannel !info %a $did(2).seltext
    }
  }
  else {
    if ($did(2).seltext isalnum) { msg #mychannel !info $v1 }
  }

S
s0tt0
s0tt0
S
hmm i cannot understand some part of this script you gave me, what are those $vl for?

I
Iori
Iori
I
It's all in the help file. /help $v1
  • If-then-else statements

    The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison.

    Basic format

    if (v1 operator v2) { commands }
    ...
    ...
    ...
    $v1 & $v2

    Returns the first and second parameters of an if-then-else comparison. So, in the case of this comparison:

    if (text isin sometext) { ... }

    $v1 will return "text" and $v2 will return "sometext".


So...
Code:
      if ($did(8).seltext isnum) { %a -r $v1 }[color:gray] | ; &lt;- $v1 = $did(8).seltext[/color]
      if ($did(6).seltext isalnum) { %a %a -g $v1 }[color:gray] | ; &lt;- $v1 = $did(6).seltext[/color]
      if ($did(4).seltext isalnum) { %a %a -s $v1 }[color:gray] | ; &lt;- $v1 = $did(4).seltext[/color]

S
s0tt0
s0tt0
S
doh yes smile now i understand and it should work, but it doesnt frown just nothing happens. and how does variable "a" gets its value?

EDIT: got it to work but it still doesnt show values like "-s" in the infoline . its says -S Unknown command and i cant understand what purpose variable "a" has in there. it should display the -r and value in the infoline, but why theres 2 of them like in here:
if ($did(6, seltext) isalnum) { %a %a -g $v1 }

Last edited by s0tt0; 05/03/05 01:12 PM.
I
Iori
Iori
I
Weird, "=" chars somehow got lost.
Anyway...
Code:
  if ($did(12).state == 1) {
    if ($did(2).seltext isalnum) {
      var %a
      if ($did(8).seltext isnum) { %a [color:blue]=[/color] -r $v1 }
      if ($did(6).seltext isalnum) { %a [color:blue]=[/color] %a -g $v1 }
      if ($did(4).seltext isalnum) { %a [color:blue]=[/color] %a -s $v1 }
      msg #mychannel !info %a $did(2).seltext
    }
  }
  else {
    if ($did(2).seltext isalnum) { msg #mychannel !info $v1 }
  }

S
s0tt0
s0tt0
S
omg thank you so much it works now perfectly smile
you've been so helpful, really appriciate it smile

CASE CLOSED


Link Copied to Clipboard