|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
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 But, it shows What is wrong with this? Btw, the nicks are saved like this %nicks nick1,nick2,nick3,nick4
Last edited by learn3r; 26/03/07 11:00 AM.
learn learn learn
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Use /didtok to add it instead of /did.
/help /didtok
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
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
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
He said /didtok, not $didtok.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
ok tried /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
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
i'm trying to set and get the variable set %nick. $+ [ $gettok($did($dname,2),1,44) ] $address($gettok($did($dname,2),1,44),2) And tried to get it 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
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
You sould evaluate the dynamic variable 2x Change this $+(%nick,.,$did($dname,1).sel) to $($+(%,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!
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
set $+(%,nick,.,$gettok($did($dname,2),1,44)) $address($gettok($did($dname,2),1,44),2)
Then,
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 * /echo: insufficient parameters 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
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,156 |
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.
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
that problem is solved.
the new variable is set to
%nick.nickhere *!*@nick'shost
learn learn learn
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
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. 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))
}
}
}
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
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
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
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. 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
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
* /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
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
i did this to add the nick's host on hash and works perfectly hadd -m nickip $gettok($did($dname,2),1,44) $address($gettok($did($dname,2),1,44),2) And this to delete it
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
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
it returned "1"
why is that?
learn learn learn
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
.sel returns the selected line *number*. If you want text, use .seltext .
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2006
Posts: 342
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2006
Posts: 342 |
at last! thanks to all of you!!!
learn learn learn
|
|
|
|
|