mIRC Home    About    Download    Register    News    Help

Print Thread
about dialog #173583
26/03/07 10:52 AM
26/03/07 10:52 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
Code:
dialog nicklist {
  title "Nick list"
  size -1 -1 144 94
  option dbu
  list 1, 7 9 50 76, size
  radio "On", 2, 90 23 20 10
  radio "Off", 3, 90 34 22 10
  text "Status", 4, 92 14 20 8
  edit "", 5, 68 63 65 10
  button "Add", 6, 68 75 29 12
  button "Delete", 7, 103 75 30 12
  text "Enter Nick", 8, 87 54 26 8
}
on *:dialog:nicklist:*:*:{
  if ($devent == init) {
    did -ra $dname 1 %nicks
  }
}


That's the code from my dialog..

i want it to show to the list on the dialog
Quote:
nick
nick
nick
nick


But, it shows

Quote:
nick,nick,nick,nick


What is wrong with this?

Btw, the nicks are saved like this

Quote:
%nicks nick1,nick2,nick3,nick4

Last edited by learn3r; 26/03/07 11:00 AM.

learn learn learn
Re: about dialog [Re: learn3r] #173584
26/03/07 11:26 AM
26/03/07 11:26 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
hixxy  Offline
Hoopy frood
H

Joined: Sep 2005
Posts: 2,876
Use /didtok to add it instead of /did.

/help /didtok

Re: about dialog [Re: hixxy] #173585
26/03/07 11:42 AM
26/03/07 11:42 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
Code:
on *:dialog:nicklist:*:*:{
  if ($devent == init) {
    did -ra $dname 1 $didtok(%nicks,0,44)
  }
}


like that?
didn;t worked
got an invalid parameters

Last edited by learn3r; 26/03/07 11:44 AM.

learn learn learn
Re: about dialog [Re: learn3r] #173588
26/03/07 12:16 PM
26/03/07 12:16 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
qwerty  Offline
Hoopy frood
Q

Joined: Jan 2003
Posts: 2,523
He said /didtok, not $didtok.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: about dialog [Re: qwerty] #173589
26/03/07 12:46 PM
26/03/07 12:46 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
ok tried

Code:
/didtok -ra $dname 1 %nicks


But returned nothing on the dialog


i got it... thanks

Last edited by learn3r; 26/03/07 01:22 PM.

learn learn learn
Re: about dialog [Re: learn3r] #173597
26/03/07 02:37 PM
26/03/07 02:37 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
i'm trying to set and get the variable

Code:
set %nick. $+ [ $gettok($did($dname,2),1,44) ] $address($gettok($did($dname,2),1,44),2)  


And tried to get it
Code:
if ($+(%nick,.,$did($dname,1).sel)) { ruser nick $+(%nick,.,$did($dname,1).sel) }


i tried to echo it but it returns "1"
not the ip of the added nick...

How can i get it?


learn learn learn
Re: about dialog [Re: learn3r] #173601
26/03/07 04:51 PM
26/03/07 04:51 PM
Joined: Mar 2005
Posts: 420
X
xDaeMoN Offline
Fjord artisan
xDaeMoN  Offline
Fjord artisan
X

Joined: Mar 2005
Posts: 420
You sould evaluate the dynamic variable 2x

Change this
Code:
$+(%nick,.,$did($dname,1).sel)

to
Code:
$($+(%,nick,.,$did($dname,1).sel),2)


* $() is short for $eval

I also noticed that on the first code you have ID 2, then on your second code you have ID 1. Is that a typo or what. I just left it like what you have right now. Just FYI.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Re: about dialog [Re: xDaeMoN] #173629
27/03/07 12:03 AM
27/03/07 12:03 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
Code:
set $+(%,nick,.,$gettok($did($dname,2),1,44)) $address($gettok($did($dname,2),1,44),2)


Then,

Code:
echo -a $($+(%,nick,.,$did($dname,1).sel),2)
if ($($+(%,nick,.,$did($dname,1).sel),2)) { ruser nick $($+(%,nick,.,$did($dname,1).sel),2) }


It's just return

Quote:
* /echo: insufficient parameters


Quote:
I also noticed that on the first code you have ID 2, then on your second code you have ID 1. Is that a typo or what. I just left it like what you have right now. Just FYI.


the first one is for adding it
ID2 edit
ID1 list

Last edited by learn3r; 27/03/07 12:07 AM.

learn learn learn
Re: about dialog [Re: learn3r] #173642
27/03/07 01:42 AM
27/03/07 01:42 AM
Joined: Jan 2007
Posts: 1,156
Seattle
D
DJ_Sol Offline
Hoopy frood
DJ_Sol  Offline
Hoopy frood
D

Joined: Jan 2007
Posts: 1,156
Seattle
You need to specify the token seperator with /didtok.

didtok $dname <id> 44 %nicks

Since the nicknames are seperated with a comma, $chr(44) is used.

Re: about dialog [Re: DJ_Sol] #173643
27/03/07 01:50 AM
27/03/07 01:50 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
that problem is solved.

the new variable is set to

%nick.nickhere *!*@nick'shost


learn learn learn
Re: about dialog [Re: learn3r] #173644
27/03/07 02:07 AM
27/03/07 02:07 AM
Joined: Aug 2004
Posts: 7,252
Ontario, Canada
R
RusselB Offline
Planetary brain
RusselB  Offline
Planetary brain
R

Joined: Aug 2004
Posts: 7,252
Ontario, Canada
I think this is what you're looking for, however, if it's not, and you wouldn't mind telling me what the purpose of the dialog is, then I may be able to write up something better.
Code:
on *:dialog:nicklist:*:*:{
  if ($devent == init) {
    didtok $dname 1 44 %nicks
  }
  if $devent == sclick {
    if $did == 6 {
      set $+(%,nick,.,$iif($did(5),$v1,$did(1).seltext)) $address($iif($did(5),$v1,$did(1).seltext),2)
    }
    elseif $did == 7 {
      unset $+(%,nick,.,$iif($did(5),$v1,$did(1).seltext))
    }
  }
}

Re: about dialog [Re: RusselB] #173645
27/03/07 03:18 AM
27/03/07 03:18 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
Code:
 if ($devent == sclick) {
  if ( $did == 3 ) && ( $did($dname,2) != $null ) {
    %nick = $addtok(%nick,$gettok($did($dname,2),1,44),44)
    auser -a nick $address($gettok($did($dname,2),1,44),2)
    did -a $dname 1 $gettok($did($dname,2),1,44)
      ;set $+(%,nick,.,$gettok($did($dname,2),1,44)) $address($gettok($did($dname,2),1,44),2)
    did -ra $dname 2
  }
  if ( $did == 4 ) {
    if ( $did($dname,1).sel != $null ) {
      %nick = $deltok(%nick,$did($dname,1).sel,44)
        ;if ($($+(%,nick,.,$did($dname,1).sel),2)) { ruser nick $($+(%,nick,.,$did($dname,1).sel),2) }
      did -d $dname 1 $did($dname,1).sel
    }
  }
}



That is my code
i set the host of the nick added on the auser to %nick.host so if i delete the selected nick on the list it'll ruser it too on the userlist.


learn learn learn
Re: about dialog [Re: learn3r] #173649
27/03/07 05:15 AM
27/03/07 05:15 AM
Joined: Aug 2004
Posts: 7,252
Ontario, Canada
R
RusselB Offline
Planetary brain
RusselB  Offline
Planetary brain
R

Joined: Aug 2004
Posts: 7,252
Ontario, Canada
You have some ID's in your code that don't properly correspond with the ID's in your dialog layout.
Here's a massive re-write of your code, along with some features and recommendations.
Note: The menu system was added simply to make it easier for me to test.
Code:
dialog nicklist {
  title "Nick list"
  size -1 -1 144 94
  option dbu
  list 1, 7 9 50 76, size
  radio "On", 2, 90 23 20 10, group
  radio "Off", 3, 90 34 22 10
  text "Status", 4, 92 14 20 8
  edit "", 5, 68 63 65 10
  button "Add", 6, 68 75 29 12
  button "Delete", 7, 103 75 30 12
  text "Enter Nick", 8, 87 54 26 8
}
on *:start:{
  if !$hget(nicklist) { .hmake nicklist 100 }
  if $exists(nicklist.hsh) { .hload nicklist nicklist.hsh }
}
on *:exit:{
  .hsave -o nicklist nicklist.hsh
}
on *:disconnect:{
  .hsave -o nicklist nicklist.hsh
}
on *:dialog:nicklist:*:*:{
  if $devent == init {
    var %a = 1, %b = $hget(nicklist,0).item
    while %a <= %b {
      did -a $dname 1 $hget(nicklist,%a).item
      .auser nick $nicklist($hget(nicklist,%a).item)
      inc %a
    }
    did -b $dname 6,7
  }
  elseif $devent == edit && $did == 5 {    did -e $dname 6,7  }
  elseif $devent == sclick {
    if $did == 1 {      did -e $dname 7    }
    elseif $did == 6 {
      did -b $dname 6,7
      if !$didwm($dname,1,$did(5)) {        did -a $dname 1 $did(5)      }
      did -r $dname 5
      .hadd -m nicklist $did(5) $nicklist($did(5))
      .auser nick $nicklist($hget(nicklist,%a).item)
    }
    elseif $did == 7 {
      if $did(1).sel {
        .hdel nicklist $did(1).seltext
        did -d $dname 1 $did(1).sel
        .ruser nick $nicklist($did(1).seltext)
      }
      else {
        .hdel nicklist $did(5)
        did -r $dname 5
        did -d $dname 1 $didwm($dname,1,$did(5))
        .ruser nick $nicklist($did(5))
      }
    }
    elseif $devent == dclick && $did == 1 {
      .hdel nicklist $did(1).seltext
      did -d $dname 1 $did(1).sel
      .ruser nick $nicklist($did(1).seltext)
    }
  }
}
menu * {
  Learn3r's nicklist : dialog $iif(!$dialog(nicklist),-md,-ev) nicklist nicklist
}
alias -l nicklist {
  .enable #nicklist_who
  .who $1
}
#nicklist_who off
raw 315:*:{
  .disable #nicklist_who
  haltdef
}
raw 352:{
  return $4
  haltdef
}
#nicklist_who end

Re: about dialog [Re: RusselB] #173658
27/03/07 09:42 AM
27/03/07 09:42 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
Quote:
* /hadd: insufficient parameters (line 41, script10.mrc)
-
/WHO [+|-][achmnsuCM] [args]
Flags are specified like channel modes,
The flags cghimnsu all have arguments
Flags are set to a positive check by +, a negative check by -
The flags work as follows:
Flag a: user is away
Flag c <channel>: user is on <channel>,
no wildcards accepted
Flag h <host>: user has string <host> in their hostname,
wildcards accepted
Flag m <usermodes>: user has <usermodes> set on them,
only usermodes o/O/a/A will return a result
Flag n <nick>: user has string <nick> in their nickname,
wildcards accepted
Flag s <server>: user is on server <server>,
wildcards not accepted
Flag u <user>: user has string <user> in their username,
wildcards accepted
Behavior flags:
Flag C: show first visible channel user is in
Flag M: check for user in channels I am a member of




learn learn learn
Re: about dialog [Re: learn3r] #173659
27/03/07 09:58 AM
27/03/07 09:58 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
i did this to add the nick's host on hash and works perfectly
Code:
hadd -m nickip $gettok($did($dname,2),1,44) $address($gettok($did($dname,2),1,44),2)


And this to delete it
Code:
if ($hget(nickip,$did($dname,1).sel)) { hdel nickip $did($dname,1).sel }
 


But it doesn't deletes it..
What is wrong with my hdel?

Last edited by learn3r; 27/03/07 10:01 AM.

learn learn learn
Re: about dialog [Re: learn3r] #173660
27/03/07 11:08 AM
27/03/07 11:08 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
qwerty  Offline
Hoopy frood
Q

Joined: Jan 2003
Posts: 2,523
I'll never get tired of repeating this: /echo is your best friend. Stick one in front of your commands or in front of specific identifiers, then look at what is printed.

I'm guessing here, but $did($dname,1).sel may not return what you think. To make sure, just print it in your Status with /echo:

echo -s $!did().sel returned: $did($dname,1).sel




/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: about dialog [Re: qwerty] #173661
27/03/07 12:50 PM
27/03/07 12:50 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
it returned "1"

why is that?


learn learn learn
Re: about dialog [Re: learn3r] #173667
27/03/07 01:17 PM
27/03/07 01:17 PM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Planetary brain
Riamus2  Offline
Planetary brain

Joined: Oct 2004
Posts: 8,327
MA, USA
.sel returns the selected line *number*. If you want text, use .seltext . smile


Invision Support
#Invision on irc.irchighway.net
Re: about dialog [Re: Riamus2] #173679
27/03/07 03:44 PM
27/03/07 03:44 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
learn3r  Offline OP
Fjord artisan
L

Joined: Oct 2006
Posts: 342
at last! thanks to all of you!!!


learn learn learn