mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
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,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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
    }
  }
} 

Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
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,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Post in the code that you have, dialog, sclicks, inits etc. See if we can unveil it.

Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
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,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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


Gone.
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
but still how can i fix it so it shows only those commands what i have chosen in dialog box from options?

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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 }
  }

Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
hmm i cannot understand some part of this script you gave me, what are those $vl for?

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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]

Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
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.
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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 }
  }

Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
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