mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 15
C
CaNNoN Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Feb 2003
Posts: 15
hYa ... i need help :| .. i've scripted a highlight addon .. and now it crashes mirc .. but why ? here is the code

Code:
on *:LOAD:{ 
  echo -at $style 0/MESSAGES:14 Script Loaded.
  echo -at $style 0/MESSAGES:14 Type: /messages to start.
  echo -at $style 
  echo -at $style 0/MESSAGES:14 Thank you for using ! ;o)
}
alias messages { dialog -rm message message }
dialog message {
  title "You've got Message!"
  size -1 -1 110 104
  option dbu
  icon $mircdirIcons\message.ico, 0
  button "Ok", 9, 55 89 55 15, cancel
  button "View Log", 10, 0 89 55 15, ok
  tab "Msg", 14, 0 -1 110 89
  text "Nick:", 1, 6 22 13 8, tab 14
  text "Chan:", 2, 6 35 17 8, tab 14
  text "Network:", 13, 6 48 23 8, tab 14
  text "Message:", 3, 6 61 24 8, tab 14
  text "Time/Date:", 4, 6 74 27 8, tab 14
  edit "", 5, 40 21 65 10, tab 14 read autohs
  edit "", 6, 40 34 65 10, tab 14 read autohs
  edit "", 12, 40 47 65 10, tab 14 read autohs
  edit "", 7, 40 60 65 10, tab 14 read autohs
  edit "", 8, 40 73 65 10, tab 14 read autohs
  box "Info", 11, 2 14 105 72, tab 14
  tab "Set Highlights", 15
  edit "", 47, 14 24 40 10, tab 15 autohs
  check "", 48, 4 24 7 10, tab 15
  check "", 49, 4 33 7 10, tab 15
  edit "", 43, 14 33 40 10, tab 15 autohs
  edit "", 42, 54 24 40 10, tab 15 autohs
  check "", 53, 98 24 7 10, tab 15
  edit "", 58, 54 33 40 10, tab 15 autohs
  check "", 54, 98 33 7 10, tab 15
  box "Your Highlights", 41, 2 14 105 72, tab 15
  check "", 50, 4 42 7 10, tab 15
  edit "", 44, 14 42 40 10, tab 15 autohs
  edit "", 59, 54 42 40 10, tab 15 autohs
  check "", 55, 98 42 7 10, tab 15
  edit "", 60, 54 51 40 10, tab 15 autohs
  edit "", 45, 14 51 40 10, tab 15 autohs
  check "", 51, 4 51 7 10, tab 15
  check "", 56, 98 51 7 10, tab 15
  check "", 52, 4 60 7 10, tab 15
  edit "", 46, 14 60 40 10, tab 15 autohs
  check "", 57, 98 60 7 10, tab 15
  edit "", 61, 54 60 40 10, tab 15 autohs
  text "Note: Tick the radio Buttons for enable.", 62, 4 70 100 7, tab 15
  text "<your Nick> = $me", 63, 17 77 87 7, tab 15
  tab "Options", 40
  radio "On", 16, 8 23 21 9, group tab 40
  radio "Off", 18, 8 32 22 8, tab 40
  box "Highlight", 17, 2 15 106 27, tab 40
  box "Highlight Color (Log)", 19, 2 44 106 32, tab 40
  icon 20, 4 53 101 8, $mircdirIcons\farben.jpg, 0, tab 40
  radio "", 21, 4 64 6 10, group tab 40
  radio "", 22, 10 64 6 10, tab 40
  radio "", 23, 16 64 6 10, tab 40
  radio "", 24, 23 64 6 10, tab 40
  radio "", 25, 29 64 6 10, tab 40
  radio "", 26, 35 64 6 10, tab 40
  radio "", 27, 41 64 6 10, tab 40
  radio "", 28, 48 64 6 10, tab 40
  radio "", 29, 54 64 6 10, tab 40
  radio "", 30, 61 64 6 10, tab 40
  radio "", 38, 67 64 6 10, tab 40
  radio "", 31, 73 64 6 10, tab 40
  radio "", 32, 79 64 6 10, tab 40
  radio "", 33, 86 64 6 10, tab 40
  radio "", 34, 92 64 6 10, tab 40
  radio "", 35, 99 64 6 10, tab 40
  text "(c) 2003 by", 36, 2 78 29 8, tab 40
  link "CaNNoN", 39, 31 78 22 8, tab 40
  link "Chat with me!", 37, 74 78 34 8, tab 40
  check "Only Log (No Dialog)", 64, 39 23 60 9, tab 40
  check "Enable Sound", 65, 39 32 44 9, tab 40
  button "Set", 66, 86 33 13 7, tab 40
}

on *:TEXT:*:#:{
  if (%highlight.message.control == 1) {
    %x.msg = 10
    while (%x.msg > 0) { 
      if (%highlight. [ $+ [ %x.msg ] ] isin $1-) && (%highlight. [ $+ [ %x.msg ] ] .check == 1) {
        highlight.save $1- 
        write highlight.messages.txt $time(HH:nn:ss - dd.mm.yyyy) - ( $+ $nick - $chan - $network $+ ) -> $replace($1-,%highlight. [ $+ [ %x.msg ] ],%highlight.log.col $+ %highlight. [ $+ [ %x.msg ] ] $+ )
        dec %x.msg 
      }  
    }
  }
}
on *:DIALOG:message:init:*:{
  if (!%highlight.message.control) { set %highlight.message.control 0 }
  if (!%highlight.message.dialog) { set %highlight.message.dialog 0 }
  if (!%highlight.message.sound) { set %highlight.message.sound 0 }
  if (%highlight.1.check == 1) { .did -c message 48 }
  if (%highlight.2.check == 1) { .did -c message 49 }
  if (%highlight.3.check == 1) { .did -c message 50 }
  if (%highlight.4.check == 1) { .did -c message 51 }
  if (%highlight.5.check == 1) { .did -c message 52 }
  if (%highlight.6.check == 1) { .did -c message 53 }
  if (%highlight.7.check == 1) { .did -c message 54 }
  if (%highlight.8.check == 1) { .did -c message 55 }
  if (%highlight.9.check == 1) { .did -c message 56 }
  if (%highlight.10.check == 1) { .did -c message 57 }
  if (%highlight.message.control == 1) { .did -c message 16 }
  if (%highlight.message.control == 0) { .did -c message 18 }
  if (%highlight.message.dialog == 1) { .did -c message 64 }
  if (%highlight.message.sound == 1) { .did -c message 65 }
  if (%highlight.log.col.enable) { did -c message %highlight.log.col.enable }
  did -a message 5 %highlight.message.nick
  did -a message 6 %highlight.message.chan
  did -a message 7 $strip(%highlight.message.txt,burcmo)
  did -a message 12 %highlight.message.network
  did -a message 8 %highlight.message.datetime
  did -a message 47 %highlight.1
  did -a message 43 %highlight.2
  did -a message 44 %highlight.3
  did -a message 45 %highlight.4
  did -a message 46 %highlight.5
  did -a message 42 %highlight.6
  did -a message 58 %highlight.7
  did -a message 59 %highlight.8
  did -a message 60 %highlight.9
  did -a message 61 %highlight.10
}
on *:DIALOG:message:sclick:10:{
  .highlight.message.window
}
on *:DIALOG:message:sclick:48:{
  set %highlight.1.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:49:{
  set %highlight.2.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:50:{
  set %highlight.3.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:51:{
  set %highlight.4.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:52:{
  set %highlight.5.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:53:{
  set %highlight.6.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:54:{
  set %highlight.7.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:55:{
  set %highlight.8.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:56:{
  set %highlight.9.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:57:{
  set %highlight.10.check $did($dname,$did).state
}
on *:DIALOG:message:sclick:16:{
  if (%highlight.message.control == 0) {
    set %highlight.message.control 1
  }
}
on *:DIALOG:message:sclick:18:{
  if (%highlight.message.control == 1) {
    set %highlight.message.control 0
  }
}
on *:DIALOG:message:sclick:64:{
  set %highlight.message.dialog $did($dname,$did).state
}
on *:DIALOG:message:sclick:65:{
  set %highlight.message.sound $did($dname,$did).state
  if (!%highlight.message.soundfile) { 
    set %highlight.message.soundfile $sfile(C:\,Choose a sound for Highlight,Choose!) 
  }
}
on *:DIALOG:message:sclick:66:{
  set %highlight.message.soundfile $sfile(C:\,Choose a sound for Highlight,Choose!)
}
on *:DIALOG:message:sclick:21:{
  set %highlight.log.col 0
  set %highlight.log.col.enable 21
}
on *:DIALOG:message:sclick:22:{
  set %highlight.log.col 1
  set %highlight.log.col.enable 22
}
on *:DIALOG:message:sclick:23:{
  set %highlight.log.col 2
  set %highlight.log.col.enable 23
}
on *:DIALOG:message:sclick:24:{
  set %highlight.log.col 3
  set %highlight.log.col.enable 24
}
on *:DIALOG:message:sclick:25:{
  set %highlight.log.col 4
  set %highlight.log.col.enable 25
}
on *:DIALOG:message:sclick:26:{
  set %highlight.log.col 5
  set %highlight.log.col.enable 26
}
on *:DIALOG:message:sclick:27:{
  set %highlight.log.col 6
  set %highlight.log.col.enable 27
}
on *:DIALOG:message:sclick:28:{
  set %highlight.log.col 7
  set %highlight.log.col.enable 28
}
on *:DIALOG:message:sclick:29:{
  set %highlight.log.col 8
  set %highlight.log.col.enable 29
}
on *:DIALOG:message:sclick:30:{
  set %highlight.log.col 9
  set %highlight.log.col.enable 30
}
on *:DIALOG:message:sclick:38:{
  set %highlight.log.col 10
  set %highlight.log.col.enable 38
}
on *:DIALOG:message:sclick:31:{
  set %highlight.log.col 11
  set %highlight.log.col.enable 31
}
on *:DIALOG:message:sclick:32:{
  set %highlight.log.col 12
  set %highlight.log.col.enable 32
}
on *:DIALOG:message:sclick:33:{
  set %highlight.log.col 13
  set %highlight.log.col.enable 33
}
on *:DIALOG:message:sclick:34:{
  set %highlight.log.col 14
  set %highlight.log.col.enable 34
}
on *:DIALOG:message:sclick:35:{
  set %highlight.log.col 15
  set %highlight.log.col.enable 36
}
on *:DIALOG:message:sclick:39:{
  .run -n mailto:CaNNoNRuLeS@msn.com
}
on *:DIALOG:message:sclick:37:{
  .run irc://irc.german-fxp.net/#CaNNoN
}
on *:DIALOG:message:sclick:9:{
  set %highlight.1 $did(47).text
  set %highlight.2 $did(43).text
  set %highlight.3 $did(44).text
  set %highlight.4 $did(45).text
  set %highlight.5 $did(46).text
  set %highlight.6 $did(42).text
  set %highlight.7 $did(58).text
  set %highlight.8 $did(59).text
  set %highlight.9 $did(60).text
  set %highlight.10 $did(61).text
  .dialog -x message 
}

alias highlight.save {
  if (%highlight.message.sound == 1) { .splay %highlight.message.soundfile }
  if (%highlight.message.dialog == 0) {
    if ($dialog(message) == message) { .dialog -x message message }
    set %highlight.message.txt $1- 
    set %highlight.message.nick $nick
    set %highlight.message.chan $chan
    set %highlight.message.network $network
    set %highlight.message.datetime $time - $date
    .dialog -rmdi message message
  }
}
alias highlight.message.window {
  if (!$window(@Messages)) {
    window -abzt @Messages 440 0 350 600 @Messages
    highlight.messages.alines 
  }
  else { highlight.messages.alines }
}
alias highlight.messages.alines {
  if (!$window(@Messages)) { goto end }
  clear @Messages
  titlebar @Messages Your recieved Messages
  set %message.ttl $lines(highlight.messages.txt)
  set %x 1
  while (%x <= $lines(highlight.messages.txt)) { aline @Messages $read($mircdir\highlight.messages.txt,%x) | inc %x }
  aline @Messages $style 0/MESSAGES:14 End of /MESSAGES
  unset %message.ttl
}
menu @Messages {
  Reset Messages:{
    if ($?!="Are You Shure ?" == $true) {
      .window -c @Messages
      .remove highlight.messages.txt 
      .dialog -rm highlight.message.ready highlight.message.ready
    }
  }
}
menu channel {
  Highlight Addon
  .Dialog:/messages
  .-
  .View Messages List:/highlight.message.window
}
dialog highlight.message.ready {
  title "Reseted !!"
  size -1 -1 130 49
  option dbu
  icon 1, 12 20 30 30, $mircdir\Icons\reset.ico
  button "OK", 2, 48 28 33 12, ok
  text "Your messages has been reseted !", 5, 20 8 100 7, center
}


hope you can help me - thanks in advance

Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Just at a quick glance I noticed you have an /inc %x inside an if condition. The conditions might not be met, in which case it will continue to loop without increasing %x (infinitely):

if (%highlight. [ $+ [ %x.msg ] ] isin $1-) && (%highlight. [ $+ [ %x.msg ] ] .check == 1) {

Move it out of the if statement

Joined: Feb 2003
Posts: 15
C
CaNNoN Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Feb 2003
Posts: 15
ah.. thx now it works smile

Joined: Jan 2003
Posts: 41
T
Ameglian cow
Offline
Ameglian cow
T
Joined: Jan 2003
Posts: 41
on *:dialog:dname:sclick:*:{
if ($did == 1) { }
if ($did == 2) { }
}

Use that instead


Link Copied to Clipboard