mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Code:
 on *:TEXT:*:#FFXVI:{
  if (FFbot isin $nick) && ($did(systok,28).state == 1) {
    if ($1-3 == Sys Dow 06) && ($len($5) == 32) { 
      if (%sys.dk1 != $5) { 
        .write backup.txt %sys.dk1 $date(mm/dd) 
        %sys.dk1 = $5 
        did -rab systok 3 %sys.dk1  
      }
    }
    elseif ($1-3 == Sys Dow 46) && ($len($5) == 32) { 
      if (%sys.dk2 != $5) { 
        .write backup.txt %sys.dk2 $date(mm/dd) 
        %sys.dk2 = $5 
        did -rab systok 11 %sys.dk2 
      }
    }
    elseif ($1-3 == Sys UpT 06) && ($len($5) == 32) { 
      if (%sys.bk1 != $5) { 
        .write backup.txt %sys.bk1 $date(mm/dd) 
        %sys.bk1 = $5 
        did -rab systok 12 %sys.bk1 
      }
    }
    elseif ($1-3 == Sys UpT 46) && ($len($5) == 32) {
      if (%sys.bk2 != $5) { 
        .write backup.txt %sys.bk2 $date(mm/dd) 
        %sys.bk2 = $5 
        did -rab systok 13 %sys.bk2
      }
    }
    elseif ($1-3 == Sys UpT 93) && ($len($5) == 32) { 
      if (%sys.bk3 != $5) { 
        .write backup.txt %sys.bk3 $date(mm/dd)
        %sys.bk3 = $5 
        did -rab systok 14 %sys.bk3 
      }
    }
    elseif ($1-3 == Sys UpT 96) && ($len($5) == 32) { 
      if (%sys.bk4 != $5) { 
        .write backup.txt %sys.bk4 $date(mm/dd)
        %sys.bk4 = $5 
        did -rab systok 15 %sys.bk4 
      }
    }
    elseif ($1-3 == Sys Dow 93) && ($len($5) == 32) {
      if (%sys.dk3 != $5) {
        .write backup.txt %sys.dk3 $date(mm/dd)
        %sys.dk3 = $5
        did -rab systok 39 %sys.dk3
      }
    }
    elseif ($1-3 == Sys Dow 96) && ($len($5) == 32) {
      if (%sys.dk4 != $5) {
        .write backup.txt %sys.dk4 $date(mm/dd)
        %sys.dk4 = $5
        did -rab systok 40 %sys.dk4
      }
    }
  }
}


Everytime I trigger an event from my dialog I have incoming text such as this

Sys Dow 06 is PP3EEFFAA9ERTVBSEUIOIIPA98271892

What stays static is $1 and $4 has $2 and $3 changes with $5, $5 is always a length of 32

What this particular script does is analyze the incoming text and checks to see if $5 changed if it did then it proceeds to update my dialog as well has backup the old $5

As you may see im storing every ($5) into a var till it changes which it updates that var and my dialog im looking for a way to write this smaller and simpler because the new game is going to require 6 more addons sometime in June.

As you may see that every part of the dialog does always a length check so im wondering if I could somehow loop through the incoming data and have it checked and updated if changed (doesnt need to be in a var if easier)

Also for every PID if the PID DID not change I would like it to echo it to me in green and if it did update it in dialog etc.. and echo it to me red

EX:.

PP3EEFFAA9ERTVBSEUIOIIPA98271892 Change
PP3EEFFAA9ERTVBSEUIOIIPA98271892 No Change

Any help would be appreciated.



Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I know you're a good coder, so you should be able to figure this out, but if you need help, let me know and I'll do my best to explain. Additionally, I might be able to do better if I could also see your dialog code.
Code:
on *:TEXT:*:#FFXVI:{
  if (FFbot isin $nick) && ($did(systok,28).state == 1) && ($len($5) == 32) && ($1 == Sys) {
    var %sys = $findtok(06 46 93 96,$3,32)
    if $2 == Dow {
      if %sys {
        if $($+(%,sys.dk,%sys),2) != $5 {
          .write backup.txt $($+(%,sys.dk,%sys),2) $date(mm/dd) 
          $+(%,sys.dk,%sys) = $5 
          did -rab systok $gettok(3 11 39 40,%sys,32) $($+(%,sys.dk,%sys),2)
          echo 4 -a $5
        }
        else {          echo 3 -a $5        }
      }
    }
    elseif $2 == UpT {
      if %sys {
        if $($+(%,sys.bk,%sys),2) != $5 {
          .write backup.txt $($+(%,sys.bk,%sys),2) $date(mm/dd) 
          $+(%,sys.bk,%sys) = $5 
          did -rab systok $gettok(12 13 14 15,%sys,32) $($+(%,sys.bk,%sys),2)
          echo 4 -a $5
        }
        else {          echo 3 -a $5        }
      }
    }
  }
}

Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Alright thanks RusselB I wish it was still smaller a bit but thats good for now until its a smaller ill show you the dialog so you can get a ruff idea of what im trying to do and why I want this less lenghty has possible lol

Code:
dialog systok {
  title "SysPID - Module 3"
  size -1 -1 275 224
  option dbu
  tab "Keys", 2, 4 3 202 148
  edit "", 3, 37 28 109 10, tab 2
  text "PID Key 86", 4, 8 29 25 8, tab 2
  text "SYS DOW 06", 5, 150 30 36 8, tab 2
  text "PID Key", 6, 8 42 25 8, tab 2
  edit "", 12, 37 79 109 10, tab 2
  edit "", 13, 37 92 109 10, tab 2
  edit "", 14, 37 105 109 10, tab 2
  edit "", 15, 37 118 109 10, tab 2
  text "SYS UPT 96", 20, 150 119 35 8, tab 2
  text "SYS UPT 93", 19, 150 105 38 8, tab 2
  text "SYS UPT 46", 18, 150 92 37 8, tab 2
  text "SYS UPT 06", 17, 150 79 37 8, tab 2
  text "SYS DOW 46", 16, 150 43 35 8, tab 2
  edit "", 11, 37 41 109 10, tab 2
  text "PID Key", 8, 8 80 25 8, tab 2
  text "PID Key", 7, 8 93 25 8, tab 2
  text "PID Key", 9, 8 106 25 8, tab 2
  text "PID Key", 10, 8 119 25 8, tab 2
  button ".:Irc PID Check:.", 27, 214 61 55 12, tab 2 flat
  edit "", 39, 37 54 109 10, tab 2
  edit "", 40, 37 66 109 10, tab 2
  text "PID Key", 41, 8 55 24 8, tab 2
  text "PID Key", 42, 8 67 24 8, tab 2
  text "SYS DOW 93", 43, 150 56 35 8, tab 2
  text "SYS DOW 96", 44, 150 68 36 8, tab 2
  check "Auto Listen 4 PIDS", 28, 213 15 56 10, tab 2 flat
  button ".:Enable All ID's:.", 29, 214 31 55 12, tab 2 flat
  button ".:Create Alignment:.", 30, 214 46 55 12, tab 2 flat
  box "", 36, 5 152 202 14, tab 2
  text "PID logger Extension", 37, 6 157 199 8, tab 2 center
  list 31, 3 167 203 56, tab 2 size vsbar
  edit "AABBCCDDAABBCCDD", 46, 76 135 62 10, disable tab 2
  text "Password:", 47, 48 136 26 8, tab 2
  button ".:Internet PIDS:.", 48, 214 76 55 12, tab 2 flat
  text "--------------------------", 49, 215 92 54 8, tab 2
  tab "Topic", 1
  edit "", 21, 28 23 154 34, tab 1 multi autovs
  edit "", 23, 28 95 154 34, tab 1 multi autovs
  edit "", 22, 28 58 154 34, tab 1 multi autovs
  text "FFXVI", 24, 5 35 23 8, tab 1
  text "ADMIN", 25, 5 72 22 8, tab 1
  text "IRCHELP", 26, 4 109 22 8, tab 1
  tab "&Weather", 62
  text ".:Zip/Postal code:.", 64, 73 103 59 8, tab 62 center
  button ".:Get:.", 66, 88 124 27 12, tab 62 flat
  edit "", 65, 87 112 28 10, tab 62
  icon 67, 30 40 33 24,  %wea.icon1, 0, tab 62
  icon 68, 86 40 33 24,  %wea.icon2, 0, tab 62
  icon 69, 138 40 33 24,  %wea.icon3, 0, tab 62
  text "Low 33 C / Hi 33CF", 72, 22 66 49 8, tab 62 center
  text "Low 33 C / Hi 33CF", 73, 79 66 49 8, tab 62 center
  text "Low 33 C / Hi 33CF", 74, 132 66 49 8, tab 62 center
  text "", 77, 22 76 49 24, tab 62
  text "", 79, 132 76 49 24, tab 62
  text "", 78, 79 76 49 24, tab 62
  text "Wednesday, Oct 26", 82, 21 29 52 8, tab 62 center
  text "Wednesday, Oct 26", 83, 75 29 52 8, tab 62 center
  text "Wednesday, Oct 26", 84, 129 29 52 8, tab 62 center
  box "", 63, 17 24 168 114, tab 62
  tab "LSCN", 87
  list 88, 7 21 158 128, tab 87 size
  button ".:Get:.", 89, 171 23 31 12, tab 87 flat
  button ".:Goto:.", 98, 171 38 31 12, tab 87 flat
  tab "&ICont", 90
  list 91, 5 19 198 114, tab 90 size hsbar vsbar
  button ".:Get:.", 92, 63 135 37 12, tab 90 flat
  button ".:GOTO Main:.", 93, 104 135 40 12, tab 90 flat
  tab "&Osprey", 94
  list 95, 5 19 157 129, tab 94 size vsbar
  button ".:Get:.", 96, 164 22 37 12, tab 94
  button ".:GOTO:.", 97, 164 37 37 12, tab 94
  tab "Ddel", 32
  button "", 38, 2 0 7 5, flat
  button ".:About Program:.", 45, 214 137 55 12, flat
  box "", 34, 210 9 64 143
}


Btw when you start the dialog if by any chance its not configured to be its original size youll find a little small dialog button at the top left corner click on it to resize from minimize to maximize

EDIT:

%SYS.BK1 Unknown command
-
%SYS.BK2 Unknown command
-
%SYS.BK1 Unknown command
-
%SYS.BK2 Unknown command


Even though the PID are the same it thinks its wrong it shows updates my dialog immediately over and over.

Further inspection into the script I noticed that you used $findtok(06 46 93 96,$3,32) im sorry for this, i forgot to mention that some days the PID will have a split chunk of data example

(06) 32323232323232323233232323232
(06) 3232323233232323FFFFG12322232
(46) 29839282983298983298293923839
(46) 92489244249249242489249284892

93 and 96 does not stay static sorry about that.

Last edited by Lpfix5; 23/04/08 01:29 PM.

Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
My apologies.. to get rid of those Unknown Command errors, change the two lines that currently read
Code:
$+(%,sys.dk,%sys) = $5
to
Code:
var $+(%,sys.dk,%sys) = $5


As to your dialog, I haven't really looked at it yet.. I was more concerned with correcting that error.. watch for further posts.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
//var won't work if the variable name does not begin with a %, use //set -l instead smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The usage of
Code:
var $+(%,sys.dk,%sys)
is identical to using
Code:
var %sys.dk $+ %sys
I have used this method in many of my scripts.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
It wouldn't be too hard to try stuff before making assertive statements, would it:

//var $+(%,testhi) = hi | echo -ag %testhi


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
See qwerty's post, I'm not sure about how many of your scripts works wink

Last edited by Wims; 24/04/08 12:49 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
OK.. At first I thought it was due to the fact that you weren't double evaluating the variable in the echo, but when I tried your suggestion, both with and without the double evaluation it didn't work. I don't know why it's not working there, yet it does work in scripts like my Scrolling Titlebar where it's used to track the time elapsed in a query window on a query by query basis.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
It's not working here because it has never worked, it's how //var behave.
In your code, you simply use /set

Last edited by Wims; 24/04/08 02:42 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
LoL, I just want a shorter way to write the code, play nice guys


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Thanks RusselB with the help of what you wrote we changed the seeding of the PIDS format so it corresponds shorter this is the finishing script

Code:
on *:text:*SYS*:#FFXVI:{
  if (FFbot isin $nick) && ($len($5) == 32) && ($did(systok,28).state == 1) {
    var %sys = $findtok(000106 000146 000506 000696 000700 000800 000914,$remove($gettok($1-,2-3,32),$chr(32)),32)
    if ($($+(% $+ sys.bk,%sys),2) != $5) { 
      .write backup.txt $v1 $date(mm/dd)
      set %sys.bk $+ %sys  $5
      did -rab systok $gettok(12 13 14 15 3 11 39,%sys,32) $v1
      echo 4 -a $v1 changed 
    }
    else { echo 8 -a No change }
  }
}


Don't know if it can be made smaller has I even used $v1 to subsitute whats happening in the beginning of IF we even by changing the script around we noticed one PID is not required has it wasn't used yet.

But again thanks


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can shorten it a bit more by replacing
$remove($gettok($1-,2-3,32),$chr(32))
with
$2 $+ $3


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
thanks


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }

Link Copied to Clipboard