mIRC Home    About    Download    Register    News    Help

Print Thread
#124519 07/07/05 04:35 PM
Joined: Jan 2005
Posts: 9
R
Ravich Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jan 2005
Posts: 9
Hello Guys(sorry blush smile )...I have a problem with this code. Well actually the problem occurs when I delete a word form the top of the list. The list doesn't reshapes but a blank line stays at the top. Please help me to make it work properly 10x smirk


Text ReplaceR:/txtr
-
}
alias txtr /dialog -m txt txt
dialog txt {
title "Text Replacer"
icon "replacer.ico"
size -1 -1 150 148
option dbu
text "Text ReplaceR", 1, 28 6 91 9, center
button "Ok", 2, 9 134 21 9
button "Close", 3, 114 133 21 9, cancel
list 8, 9 19 128 63, sort extsel
edit "", 9, 67 84 70 10, autohs
edit "", 10, 67 97 70 10, autohs
text "Insert Word", 12, 9 86 33 8
text "Insert Replacing Word", 13, 9 99 55 8
button "Add", 15, 40 115 24 8, ok
button "Delete", 16, 83 115 24 8
}
on 1:dialog:txt:sclick:2: dialog -c txt txt
on 1:dialog:txt:sclick:15:{ /if ($did(txt,8).sel == $null) {
/if ($did(txt,9) == $null) || ($did(txt,10) == $null) { /halt }
/inc %ttall | /set % [ $+ tekst $+ [ %ttall ] ] $did(txt,9)
/set % [ $+ bytt $+ [ %ttall ] ] $did(txt,10)
.timer 1 0 .txtr
}
/else {
/set % [ $+ tekst $+ [ $did(txt,8).sel ] ] $did(txt,9)
/set % [ $+ bytt $+ [ $did(txt,8).sel ] ] $did(txt,10)
.timer 1 0 .txtr
}
}

on 1:dialog:txt:init:0:{
/set %utall 1 | /while (%utall <= %ttall) {
/did -a txt 8 [ % [ $+ tekst $+ [ %utall ] ] ]
/inc %utall
}
/unset %utall
}
on 1:dialog:txt:sclick:16: {
/unset % [ $+ tekst $+ [ $did(txt,8).sel ] ] $did(txt,9)
/unset % [ $+ bytt $+ [ $did(txt,8).sel ] ] $did(txt,10)
dialog -c txt txt | .timer 1 0 .txtr
}
on 1:dialog:txt:sclick:8:/did -r txt 9 | /did -r txt 10 | /did -a txt 9 [ % [ $+ tekst $+ [ $did(txt,8).sel ] ] ] | /did -a txt 10 [ % [ $+ bytt $+ [ $did(txt,8).sel ] ] ]
on 1:input:?:{ /if ($left($1,1) == / ) { /return }
/set %utall 1 | /while (%utall <= %ttall) {
/if ($1- == [ % [ $+ tekst $+ [ %utall ] ] ] ) { /say [ % [ $+ bytt $+ [ %utall ] ] ] | /unset %utall | /halt }
/inc %utall }
/unset %utall }}
}
on 1:input:#:{ /if ($left($1,1) == / ) { /return }
/set %utall 1 | /while (%utall <= %ttall) {
/if ($1- == [ % [ $+ tekst $+ [ %utall ] ] ] ) { /say [ % [ $+ bytt $+ [ %utall ] ] ] | /unset %utall | /halt }
/inc %utall }
/unset %utall }}
}

Last edited by Ravich; 07/07/05 04:38 PM.
#124520 07/07/05 04:36 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
It's guys, not gays, unless you had the intention of calling everyone on these forums gay grin


Gone.
#124521 07/07/05 09:14 PM
Joined: Jan 2005
Posts: 9
R
Ravich Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jan 2005
Posts: 9
Any idea where is the mistake confused frown

#124522 07/07/05 09:17 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Try..

Code:
menu channel {
  -
  Text ReplaceR: txtr 
  - 
}

On 1:Start: {
  hmake replace
  if ($isfile(replace.hsh)) hload -i replace replace.hsh
}

alias txtr dialog -m txt txt 
dialog txt { 
  title "Text Replacer" 
  icon "replacer.ico" 
  size -1 -1 150 148 
  option dbu 
  text "Text ReplaceR", 1, 28 6 91 9, center 
  button "Ok", 2, 9 134 21 9 
  button "Close", 3, 114 133 21 9, cancel 
  list 8, 9 19 128 63, extsel 
  edit "", 9, 67 84 70 10, autohs 
  edit "", 10, 67 97 70 10, autohs 
  text "Insert Word", 12, 9 86 33 8 
  text "Insert Replacing Word", 13, 9 99 55 8 
  button "Add", 15, 40 115 24 8
  button "Delete", 16, 83 115 24 8 
}

on 1:dialog:txt:sclick:2: {
  dialog -x txt txt
}

on 1:dialog:txt:sclick:15:{
  if (!$did(txt,8).sel) { 
    if (!$did(txt,9)) || (!$did(txt,10)) { /halt } 
    hadd -m replace $did(txt,9) $did(txt,10)
    did -a txt 8 $did(txt,9)
  } 
  else {
    hadd -m replace $did(txt,8).seltext $did(txt,10)
  } 
} 

on 1:dialog:txt:init:0:{ 
  var %i = 1
  while (%i &lt;= $hget(replace,0).item) {
    did -a txt 8 $hget(replace,%i).item
    inc %i
  }  
}

On 1:dialog:txt:close:0: { 
  hsave -i replace replace.hsh 
}

on 1:dialog:txt:sclick:16: {
  hdel replace $did(txt,8).seltext
  did -d txt 8 $didwm(txt,8,$did(txt,8).seltext,1)
}

on 1:dialog:txt:sclick:8: {
  did -ra txt 9 $did(txt,8).seltext
  did -ra txt 10 $hget(replace,$did(txt,8).seltext)
}

on 1:input:*: { 
  if ($left($1,1) == / ) { /return } 
  var %i = 1
  while (%i &lt;= $hget(replace,0).item) {
    if ($1- == $hget(replace,%i).item) { 
      say $hget(replace,%i).data
      halt
    } 
    inc %i
  }
}


-Andy

#124523 08/07/05 05:53 PM
Joined: Jan 2005
Posts: 9
R
Ravich Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jan 2005
Posts: 9
Hey man thanks smile It's much better now and I like your corrections thanks again cool wink

#124524 09/07/05 10:20 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Glad it is working and you like the corrections, I used Hash Tables to store your data instead of Variables and instead of increasing the Variable "%utall" $hget(replace,0).item returns the number of Replaced words.

P.S. You're welcome. smile

-Andy


Link Copied to Clipboard