Help me get this working please - 17/08/05 02:46 AM
I started this script this morning and got it mostly working. There are two bugs I've found so far. The colour codes don't work properly (the initial character, the one that comes before the colour number, is omitted, messing up the first colour sequence. The second bug is that I cant seem to get the setup dialog working right. It doesn't write the channel names to the ini file and it always sets numchans to 0. It also doesn't remember the joinchans variable, keeping it zero. The other variable seem to be fine.
I've been staring at this all day and my eyes are tired. It's probably something simple, but I can't see it for the life of me. Could someone take a look at it please?
By the way, I know it has some roundabout code in there, but I couldn't get the $var[$+ %var2] array system to work, so I had to copy/paste a whole bunch of ifs. How are you supposed to use it?
I've been staring at this all day and my eyes are tired. It's probably something simple, but I can't see it for the life of me. Could someone take a look at it please?
By the way, I know it has some roundabout code in there, but I couldn't get the $var[$+ %var2] array system to work, so I had to copy/paste a whole bunch of ifs. How are you supposed to use it?
Code:
;******************** ;*Setup dialog table* ;******************** dialog scad_setup_t { title "Scrim Advertisment 1.0 Setup" size -1 -1 127 130 option dbu tab "Channels", 1, 0 0 126 130 check "1:", 11, 4 17 16 10, tab 1 left check "2:", 12, 4 28 16 10, tab 1 left check "3:", 13, 4 39 16 10, tab 1 left check "4:", 14, 4 50 16 10, tab 1 left check "5:", 15, 4 61 16 10, tab 1 left check "6:", 16, 4 72 16 10, tab 1 left check "7:", 17, 4 83 16 10, tab 1 left check "8:", 18, 4 94 16 10, tab 1 left check "9:", 19, 4 105 16 10, tab 1 left check "10:", 110, 2 116 18 10, tab 1 left edit "", 111, 24 17 72 10, tab 1 autohs limit 255 edit "", 112, 24 28 72 10, tab 1 autohs limit 255 edit "", 113, 24 39 72 10, tab 1 autohs limit 255 edit "", 114, 24 50 72 10, tab 1 autohs limit 255 edit "", 115, 24 61 72 10, tab 1 autohs limit 255 edit "", 116, 24 72 72 10, tab 1 autohs limit 255 edit "", 117, 24 83 72 10, tab 1 autohs limit 255 edit "", 118, 24 94 72 10, tab 1 autohs limit 255 edit "", 119, 24 105 72 10, tab 1 autohs limit 255 edit "", 1110, 24 116 72 10, tab 1 autohs limit 255 tab "Theme", 2 text "Insert your theme here. Note that the last colours of the left and middle theme sections should be the colours you want the text to be.", 20, 4 20 118 20, tab 2 text "Left:", 21, 9 44 12 8, tab 2 right text "Middle:", 23, 4 56 17 8, tab 2 right text "Right:", 25, 6 68 15 8, tab 2 right edit "", 22, 25 43 97 10, tab 2 edit "", 26, 25 68 97 10, tab 2 edit "", 24, 25 55 97 10, tab 2 tab "Messages", 3 text "Clan Acronym:", 30, 4 17 35 8, tab 3 text "Match size:", 32, 4 39 27 8, tab 3 text "Server:", 34, 4 83 18 8, tab 3 text "Map:", 36, 4 61 12 8, tab 3 text "Contact info:", 38, 4 105 32 8, tab 3 edit "", 31, 4 26 118 10, tab 3 edit "", 33, 4 48 118 10, tab 3 edit "", 35, 3 70 118 10, tab 3 edit "", 37, 4 92 118 10, tab 3 edit "", 39, 4 114 92 10, tab 3 tab "Other", 4 check "Join channels as they are messaged", 60, 4 17 98 10, tab 4 button "Ok", 5, 100 114 22 12, ok } ;************************ ;*Read INI file on start* ;************************ alias readsettings { set %joinchans $readini scad.ini general joinchans set %numchans $readini scad.ini channels numchans set %chan1 $readini scad.ini channels chan1 set %chan2 $readini scad.ini channels chan2 set %chan3 $readini scad.ini channels chan3 set %chan4 $readini scad.ini channels chan4 set %chan5 $readini scad.ini channels chan5 set %chan6 $readini scad.ini channels chan6 set %chan7 $readini scad.ini channels chan7 set %chan8 $readini scad.ini channels chan8 set %chan9 $readini scad.ini channels chan9 set %chan10 $readini scad.ini channels chan10 set %tl $readini scad.ini theme left set %tm $readini scad.ini theme mid set %tr $readini scad.ini theme right set %name $readini scad.ini info name set %size $readini scad.ini info size set %map $readini scad.ini info map set %serv $readini scad.ini info serv set %info $readini scad.ini info info set %slook $readini scad.ini info slook set %sfind $readini scad.ini info sfind set %rlook $readini scad.ini info rlook set %rfind $readini scad.ini info rfind set %ram $readini scad.ini info ram set %pmme $readini scad.ini info pmme set %smessage $readini scad.ini messages smessage set %sumessage $readini scad.ini messages sumessage set %rmessage $readini scad.ini messages rmessage set %rumessage $readini scad.ini messages rumessage set %ramessage $readini scad.ini messages ramessage } alias startsetup { readsettings /dialog -m scad_setup scad_setup_t } on *:LOAD: { /echo 4 Scrim Advertisement Script v1.0 By ReK_ startsetup } on *:START: { readsettings } ;*************** ;*Dialog events* ;*************** on *:dialog:scad_setup:init:*: { if (%joinchans == 1) /did -c scad_setup 60 if (%numchans >= 1) { /did -c scad_setup 11 /did -a scad_setup 111 %chan1 } if (%numchans >= 2) { /did -c scad_setup 12 /did -a scad_setup 112 %chan2 } if (%numchans >= 3) { /did -c scad_setup 13 /did -a scad_setup 113 %chan3 } if (%numchans >= 4) { /did -c scad_setup 14 /did -a scad_setup 114 %chan4 } if (%numchans >= 5) { /did -c scad_setup 15 /did -a scad_setup 115 %chan5 } if (%numchans >= 6) { /did -c scad_setup 16 /did -a scad_setup 116 %chan6 } if (%numchans >= 7) { /did -c scad_setup 17 /did -a scad_setup 117 %chan7 } if (%numchans >= 8) { /did -c scad_setup 18 /did -a scad_setup 118 %chan8 } if (%numchans >= 9) { /did -c scad_setup 19 /did -a scad_setup 119 %chan9 } if (%numchans >= 10) { /did -c scad_setup 110 /did -a scad_setup 1110 %chan10 } /did -a scad_setup 22 %tl /did -a scad_setup 24 %tm /did -a scad_setup 26 %tr /did -a scad_setup 31 %name /did -a scad_setup 33 %size /did -a scad_setup 35 %map /did -a scad_setup 37 %serv /did -a scad_setup 39 %info } on *:dialog:scad_setup:sclick:*: { /writeini -n scad.ini general joinchans $did(60) set %c 0 if ($did(11) == 1) { inc %c /writeini -n scad.ini channels chan1 $did(111) } if ($did(12) == 1) { inc %c /writeini -n scad.ini channels chan2 $did(112) } if ($did(13) == 1) { inc %c /writeini -n scad.ini channels chan3 $did(113) } if ($did(14) == 1) { inc %c /writeini -n scad.ini channels chan4 $did(114) } if ($did(15) == 1) { inc %c /writeini -n scad.ini channels chan5 $did(115) } if ($did(16) == 1) { inc %c /writeini -n scad.ini channels chan6 $did(116) } if ($did(17) == 1) { inc %c /writeini -n scad.ini channels chan7 $did(117) } if ($did(18) == 1) { inc %c /writeini -n scad.ini channels chan8 $did(118) } if ($did(19) == 1) { inc %c /writeini -n scad.ini channels chan9 $did(119) } if ($did(110) == 1) { inc %c /writeini -n scad.ini channels chan10 $did(1110) } /writeini -n scad.ini channels numchans %c /writeini -n scad.ini theme left $did(22) /writeini -n scad.ini theme mid $did(24) /writeini -n scad.ini theme right $did(26) /writeini -n scad.ini info name $did(31) /writeini -n scad.ini info size $did(33) /writeini -n scad.ini info map $did(35) /writeini -n scad.ini info serv $did(37) /writeini -n scad.ini info info $did(39) readsettings }