mIRC Home    About    Download    Register    News    Help

Topic Options
#173583 - 26/03/07 11:52 AM about dialog
learn3r Offline
Fjord artisan

Registered: 04/10/06
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


Edited by learn3r (26/03/07 12:00 PM)
_________________________
learn learn learn

Top
#173584 - 26/03/07 12:26 PM Re: about dialog [Re: learn3r]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
Use /didtok to add it instead of /did.

/help /didtok

Top
#173585 - 26/03/07 12:42 PM Re: about dialog [Re: hixxy]
learn3r Offline
Fjord artisan

Registered: 04/10/06
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


Edited by learn3r (26/03/07 12:44 PM)
_________________________
learn learn learn

Top
#173588 - 26/03/07 01:16 PM Re: about dialog [Re: learn3r]
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
He said /didtok, not $didtok.
_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top
#173589 - 26/03/07 01:46 PM Re: about dialog [Re: qwerty]
learn3r Offline
Fjord artisan

Registered: 04/10/06
Posts: 342
ok tried

Code:
/didtok -ra $dname 1 %nicks


But returned nothing on the dialog


i got it... thanks


Edited by learn3r (26/03/07 02:22 PM)
_________________________
learn learn learn

Top
#173597 - 26/03/07 03:37 PM Re: about dialog [Re: learn3r]
learn3r Offline
Fjord artisan

Registered: 04/10/06
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

Top
#173601 - 26/03/07 05:51 PM Re: about dialog [Re: learn3r]
xDaeMoN Offline
Fjord artisan

Registered: 22/03/05
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!

Top
#173629 - 27/03/07 01:03 AM Re: about dialog [Re: xDaeMoN]
learn3r Offline
Fjord artisan

Registered: 04/10/06
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


Edited by learn3r (27/03/07 01:07 AM)
_________________________
learn learn learn

Top
#173642 - 27/03/07 02:42 AM Re: about dialog [Re: learn3r]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: 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.

Top
#173643 - 27/03/07 02:50 AM Re: about dialog [Re: DJ_Sol]
learn3r Offline
Fjord artisan

Registered: 04/10/06
Posts: 342
that problem is solved.

the new variable is set to

%nick.nickhere *!*@nick'shost
_________________________
learn learn learn

Top
#173644 - 27/03/07 03:07 AM Re: about dialog [Re: learn3r]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: 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))
    }
  }
}

Top
#173645 - 27/03/07 04:18 AM Re: about dialog [Re: RusselB]
learn3r Offline
Fjord artisan

Registered: 04/10/06
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

Top
#173649 - 27/03/07 06:15 AM Re: about dialog [Re: learn3r]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: 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

Top
#173658 - 27/03/07 10:42 AM Re: about dialog [Re: RusselB]
learn3r Offline
Fjord artisan

Registered: 04/10/06
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

Top
#173659 - 27/03/07 10:58 AM Re: about dialog [Re: learn3r]
learn3r Offline
Fjord artisan

Registered: 04/10/06
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?


Edited by learn3r (27/03/07 11:01 AM)
_________________________
learn learn learn

Top
#173660 - 27/03/07 12:08 PM Re: about dialog [Re: learn3r]
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
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

Top
#173661 - 27/03/07 01:50 PM Re: about dialog [Re: qwerty]
learn3r Offline
Fjord artisan

Registered: 04/10/06
Posts: 342
it returned "1"

why is that?
_________________________
learn learn learn

Top
#173667 - 27/03/07 02:17 PM Re: about dialog [Re: learn3r]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
.sel returns the selected line *number*. If you want text, use .seltext . smile
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173679 - 27/03/07 04:44 PM Re: about dialog [Re: Riamus2]
learn3r Offline
Fjord artisan

Registered: 04/10/06
Posts: 342
at last! thanks to all of you!!!
_________________________
learn learn learn

Top