New Optimization question.

Working on a portion that pulls information from two text files and then compares the first line in both of them to see if they are different or not. Unfortunately.. It includes spaces and that comes out really odd.

Here is the block of code to work with the files. I copied the information directly from the text files as it is, the results once the script finishes. Which doesn't make any sense to me. Since it skips a space to the output/update file. Variables %one and %two actually echo exactly the same. resulting in the same as File2.txt at the bottom. The If message portion is used to not throw a fit if a user doesn't have a donation message in their donation.

Code:
alias donations {
  var %one $read(%donateFile,n,1)
  echo -a %one
  var %two $read(%checkFile,n,1)
  echo -a %two
  var %name $gettok(%two,1,38)
  echo -a %name
  var %message $gettok(%two,2,38)
  if (%message == $chr(32)) || (%message == $null) || (%message == $chr(38)) {
    var %message default
  }
  echo -a %message
  var %donate $gettok(%two,3,38)
  echo -a %donate
  ;This line removes the $ from the dollar amount donated.  To work with the system easier.
  var %donateamount $mid(%donate,3)
  echo -a %donateamount
  ;This is the problem line.
  if (%one isin %two) { return } 
  ;Calls the donation alias to then convert donate amount to whole number and times it by 6 for points to be added to user who donated.
  ;donation %name %donateamount
  ;Currently sitting at 15 total
  var %soundcodes [BABY] [BANE] [CHCK] [DOOM] [ELCO] [ELTO] [IGBO] [MATI] [MONK] [MOOO] [MORS] [NONO] [PEWP] [TOOT] [BOON] [DINO] [SQUI] [DUKE] [BAYM] [DWDU] [MILI]
  var %soundrand 1 3 1 1 1 1 1 4 1 1 1 1 1 1 2 1 1 16 1 1 1
  ;Sets an incremental variable
  var %a 1
  while ($gettok(%soundcodes,%a,32) != $null) {
    var %v $v1
    ;echo -a v: %v
    if ($istok(%message,%v,32)) {
      var %tof $v1
    }
    if (%v isin %message) {
      var %vs $v1
      var %vss $mid(%vs,2,4)
      ;echo -a vss: %vss
      ;echo -a a: %a
      var %vsss %vss $+ $rand(1,$gettok(%soundrand,%a,32))
      ;echo -a vssstotal: %donateSounds $+ %vsss $+ .mp3
      splay %donateSounds $+ %vsss $+ .mp3
      ;echo -a vsss: %vsss
    }
    inc %a
  }
  if (%tof == $null) {
    splay %sounds $+ Alerts-Donation-Online.mp3
  }
  echo -a New Donation: %two
  write -c %checkFile %one
}


File1.txt
Code:
Targ &  & $2.50


File2.txt
Code:
Targ & & $2.50


Thank you for your time and input!

Last edited by Despized; 01/10/15 04:17 AM. Reason: Corrected Typos