www.ClassicTW.com
https://mail.black-squirrel.com/

proPing Script Source
https://mail.black-squirrel.com/viewtopic.php?f=15&t=18453
Page 1 of 1

Author:  Promethius [ Thu Jan 18, 2007 12:33 am ]
Post subject: 

Modify the script at you wish - I haven't tested this one, but it is basically the same as the .cts version with an addition of the average with min/max ping time removed.

Darn cheesing smileys.
------------------------------------------

Code:

# proPing.ts  by Promethius
# Released in the Wild:   January 2007
# Thanks go out to Elderprophet on this script.

setVar $counter 0
setVar $average 0
setVar $min 999999
setVar $max 0

# turn off all messages
send "|"
# check to see if we are at a SS friendly prompt
# and possibly if the game has Interactive Sub Prompts off
send "'*"
setDelayTrigger noSS :noSS 3000
setTextTrigger begin :begin "Type sub-space message"
pause
:noSS
echo ANSI_12 "**You appear to be at a non-friendly prompt for SS messages.*"
echo ANSI_12 "*This could be that ISP is off (bad, bad sysOp)*"
echo ANSI_11 "*Try this script from the sector Command or Citadel prompts*"
send "|"
halt
# we are good to go - send first SS message and get start time
:begin
  killalltriggers
  setTextTrigger ping :msCheck "S: ping"
  gettime  $msStart "h:m:s:zzz"
  replaceText $msStart ":" " "
  getword $msStart $ms1 4
  getword $msStart $ss1 3
  send "ping :"
  pause
# ping sent and echoed back, now to set the end time
:msCheck
  gettime  $msEnd "h:m:s:zzz"
  replaceText $msEnd ":" " "
  getWord $msEnd $ms2 4
  getword $msEnd $ss2 3
  if ($ss2 < $ss1)
     add $ss2 60
  end
  subtract $ss2 $ss1
  if ($ss2 > 0)
      multiply $ss2 1000
      add $ms2 $ss2
  end
  setVar $ms ($ms2 - $ms1)
  if ($ms < $min)
     setVar $min $ms
  end
  if ($ms > $max)
     setVar $max $ms
  end
ing
  getLength $ms $len
  setVar $pad ""
  while ($len < 5)
     setVar $pad $pad & " "
     add $len 1
  end
  send " " $ms $pad "ms*"
  add $average $ms
  # yes, this delay seems to be necessary, might be able to lower it to 100
  setdelaytrigger pingDelay ingDelay 200
  pause
ingDelay
  add $counter 1
  if ($counter = 10)
     goto one
  end
  goto :begin
  # done with getting data, now to display
  one
    setVar $hilow $average
    subtract $hilow $max
    subtract $hilow $min
    divide $hilow 8
    divide $average 10
    gosub :comment
    send "----------------*"
    send "Min: " $min "  Max: " $max "  Average: " $average $comment "*"
    send "High/Low  Removed   Average: " $hiLow "*"
    setVar $consistent ($max - $min)
    gosub :lag
    send "Min:Max Split: " $consistent "  " $lagMsg
    send "*"
    waitfor "Command"
   # restore messages
    send "|"
    halt

# ----- goSubs -----

:lag
  # lag message based on min / max ping split
  if ($consistent >= 250)
     setVar $lagMsg "Extreme Intermittent Lag Detected*"
  elseif ($consistent >= 150) and ($consistent < 250)
     setVar $lagMsg "Moderate Intermittent Lag Detected*"
  elseif ($consistent >= 75) and ($consistent < 150)
     setVar $lagMsg "Mild Intermittent Lag Detected*"
  elseif ($consistent >= 25) and ($consistent < 75)
     setVar $lagMsg "Minimal Intermittent Lag Detected*"
  elseif ($consistent < 25)
     setVar $lagMsg "No Lag has been Detected*"
  end
  return

# add a few comments for the hell of it
:comment
  if ($average <= 150)
     setVar $comment " -- Muhahahaha, bring it on!!!"
  end
  if ($average > 150) and ($average <= 200)
     setVar $comment " -- Someone is gonna get podded!"
  end
  if ($average > 200) and ($average <= 250)
     setVar $comment " -- On the edge"
  end
  if ($average > 250) and ($average <= 300)
     setVar $comment " -- Gridding, not a job, an adventure!"
  end
  if ($average > 300)
     setVar $comment " -- What the Hell am I doing here?"
  end
  return


Author:  ElderProphet [ Thu Jan 18, 2007 1:29 am ]
Post subject: 

Hey Pro, just a quick script note...
If you start with the largest value, then you can creatively bypass the less than checks, like so:

if $average > 300
...
elseif $average > 250
...
elseif $average > 150
...
else
...
end

It's a nice change from the blah ping scripts though

+EP+

Author:  Promethius [ Thu Jan 18, 2007 1:37 am ]
Post subject: 

ElderProphet wrote:
Hey Pro, just a quick script note...
If you start with the largest value, then you can creatively bypass the less than checks, like so:

if $average > 300
...
elseif $average > 250
...
elseif $average > 150
...
else
...
end

It's a nice change from the blah ping scripts though

+EP+


True on the if/elseIf and it makes reading the script a lot easier. I got sloppy at the end looks like.

I also noted on the original post that I left out turning messages back on if they were not at a SS friendly prompt. This problem will also exist in the .cts that was posted on grimytrader.com. I edited the post above to correct that a few seconds ago.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/