View unanswered posts | View active topics It is currently Mon Apr 20, 2026 10:00 pm



Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
 PlanetDisplay.ts 
Author Message
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post PlanetDisplay.ts
The script below will do a TL command and then redisplay (echo to screen) all planets in sector order instead of creation order. This allows viewing a base by sector and the planets within the sector together. The echo output is displayed below. The code does show a bubble sort routine that some may find useful.

My thanks to those that gave up their planets for this display.

Attachment:
planetdisp.PNG
planetdisp.PNG [ 38.12 KiB | Viewed 9620 times ]



Code:
# planetDisplay.ts by Promethius
# planet displays sorted by sector order
# display lines used to seperate bases
# echos to screen display only


send "v"
setTextLineTrigger maxPlanets :maxPlanets "The Maximum number of Planets per sector:"
pause
:maxPlanets
getword currentLine $maxPlanets 8
stripText $maxPlanets ","
send "|tl"
waitfor "=============================================================================="
setVar $i 1
setVar $toggle 0
:trg
setTextLineTrigger getLine :lineOut ""
setTextTrigger done :sortSectors "Corporate command"
pause

:lineOut
getword currentline $chkDone 1
if ($chkDone = "======")
     goto :skip
end
getwordpos currentline $sectorLine "Class"
if ($sectorLine > 0)
    setVar $sector[$i] $chkDone
end

add $toggle 1
if ($toggle = 1)
      setVar $line[$i] currentANSILine
elseif ($toggle = 2)
    setVar $line2[$i] currentANSILine
    setVar $toggle 0
    add $i 1
end
:skip
setTextLineTrigger getLine :lineOut ""
pause


:sortSectors
  setVar $ii ($i - 1)
  while ($ii >= 1)
    setVar $ij 1
    while ($ij <= ($ii - 1))
      setVar $ijDist1 $sector[$ij]
      stripText $ijDist1 ","
      setVar $ijNext ($ij + 1)
      setVar $ijDist2 $sector[$ijNext]
      stripText $ijDist2 ","
      if ($ijDist1 < $ijdist2)
        setVar $temp $sector[$ij]
        setVar $tempLine $line[$ij]
        setVar $tempLine2 $line2[$ij]
        setVar $Sector[$ij] $Sector[$ijNext]
        setVar $line[$ij] $line[$ijNext]
        setVar $line2[$ij] $line2[$ijNext]
        setVar $Sector[$ijNext] $temp
        setVar $line[$ijNext] $tempLine
        setVar $line2[$ijNext] $tempLine2
       end
      add $ij 1
    end
    subtract $ii 1
  end

:display
killtrigger getline
send "q"
echo ansi_15 "**                           Corporate Planet Scan"
echo "*"
echo ansi_11 "* Sector  Planet Name    Ore  Org  Equ   Ore   Org   Equ   Fighters    Citadel"
echo ansi_11 "* Shields Population    -=Productions=-  -=-=-=-=-On Hands-=-=-=-=-    Credits"
echo ansi_13 "*==============================================================================*"
setVar $dispCnt 1
setVar $sectorChng $sector[1]
setVar $overLoadCnt 0
while ($dispCnt < $i)
   if ($sectorChng <> $sector[$dispCnt])
         echo ansi_9 "------------------------------------------------------------------------------*"
      getword SECTOR.UPDATED[$sectorChng] $moDay 1
      getLength $moDay $len
      cutText $moDay $moDay 1  ($len - 5)
      getword SECTOR.UPDATED[$sectorChng] $hhmm 2
      getword SECTOR.UPDATED[$sectorChng] $amPM 3
      getDistance $dist currentSector $sectorChng
      if ($dist < 1) and (currentSector <> $sectorChng)
         setVar $dist "Unknown"
      elseif (currentSector = $sectorChng)
         setVar $dist "0"
      end
      echo ANSI_6 "  Dist: " $dist
      echo ansi_6 "  Figs: " SECTOR.FIGS.QUANTITY[$sectorChng]
      echo "  Armd: " SECTOR.MINES.QUANTITY[$sectorChng]
      echo "  Lmpt: " SECTOR.LIMPETS.QUANTITY[$sectorChng]
      echo "  Last: " $moDay " " $hhmm " " $amPM "*"
      if ($overLoadCnt > $maxPlanets)
         echo #27 "[1;5;31m           !!!! Overloaded Sector !!!!*" #27 "[0;1;34;40m"
      end
      echo ansi_9 "------------------------------------------------------------------------------*"
      setVar $sectorChng $sector[$dispCnt]
      setVar $overLoadCnt 1
   else
      add $overLoadCnt 1
   end
   if (($dispCnt + 1) = $i)
       echo ansi_13 "======   ============  ==== ==== ==== ===== ===== ===== ========== ==========*"
   end
   echo $line[$dispCnt]
   echo $line2[$dispCnt]
   add $dispCnt 1
end
send "|"
halt

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Last edited by Promethius on Sat Jan 09, 2010 12:11 am, edited 3 times in total.



Tue Dec 29, 2009 6:20 pm
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: PlanetDisplay.ts
Very slick Promethius. Was it a hard-won victory to get the planets for your display? Lol

Cheers

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Tue Dec 29, 2009 6:30 pm
Profile
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: PlanetDisplay.ts
Useful piece of display code..thanx!

but you could have caught the whole line with Currentansiline and saved all the origanal ansi color codes as well

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Tue Dec 29, 2009 6:33 pm
Profile ICQ YIM
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: PlanetDisplay.ts
I have updated the code to display the correct colors as seen in the TL display. I am not sure why I didn't think of currentAnsiLine the first time and use its capture to echo back.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Tue Dec 29, 2009 7:31 pm
Profile ICQ
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: PlanetDisplay.ts
good stuff....i popped it in my bot on a hotkeyy

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Tue Dec 29, 2009 8:26 pm
Profile ICQ YIM
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Re: PlanetDisplay.ts
Looks great but for I have one missing.

Here is what the script shows:
Attachment:
pic.JPG
pic.JPG [ 110.83 KiB | Viewed 9621 times ]


Here is a sector scan:
Attachment:
pic2.JPG
pic2.JPG [ 36.15 KiB | Viewed 9621 times ]

Seems planet 5 is being skipped tried it several times, just thought I would pass the info along.

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Tue Dec 29, 2009 8:44 pm
Profile ICQ YIM WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: PlanetDisplay.ts
I think I found the issue at the very top of the script. $i was set to 0 and should have been set to 1. I have corrected the code that is posted in the first message. See if that works and let me know please.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Tue Dec 29, 2009 9:16 pm
Profile ICQ
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Re: PlanetDisplay.ts
Yea Prom, that seems to have resolved the issue, thanks again for some good coding.

Attachment:
pic3.JPG
pic3.JPG [ 49.25 KiB | Viewed 9620 times ]

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Tue Dec 29, 2009 9:31 pm
Profile ICQ YIM WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: PlanetDisplay.ts
One thing that people might want to do in the script is turn off messages at the start of the script and then turn them back on at the end. Since the script is using a setTextLineTrigger that triggers off of "", fighter hits or a message could mess the display up a bit. Toggle messages with: send "|"

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Wed Dec 30, 2009 2:32 am
Profile ICQ
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: PlanetDisplay.ts
I use this include.


Code:
#Parrothead Comms Controler Include
#=-=-=-=-=-=--=
:off
killalltriggers
setdelaytrigger 3off :offcomms 3000
setTexttrigger 1off :1off "Displaying all messages"
setTexttrigger 2off :2off "Silencing all messages"
send "|"
pause
:offcomms
killtrigger 3off
killTrigger 1off
killTrigger 2off
goto :off
:1off
killtrigger 3off
killTrigger 1off
killTrigger 2off
send "|"
:2off
killtrigger 3off
killTrigger 1off
killTrigger 2off
echo ANSI_3 "<<<" & ANSI_12 "Comm's Off" & ANSI_3 ">>>" ANSI_0
return
#=-=-=-=-=-=--=
:on
killalltriggers
setdelaytrigger 2on :oncomms 3000
setTexttrigger 3on :3on "Displaying all messages"
setTexttrigger 4on :4on "Silencing all messages"
send "|"
pause
:oncomms
killtrigger 2on
killTrigger 3on
killTrigger 4on
goto :on
:4on
killtrigger 2on
killTrigger 3on
killTrigger 4on
send "|"
:3on
killtrigger 2on
killTrigger 3on
killTrigger 4on
echo ANSI_3 "<<<" & ANSI_15 "Comm's On" & ANSI_3 ">>>" ANSI_0
return

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Wed Dec 30, 2009 2:38 am
Profile ICQ YIM
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: PlanetDisplay.ts
Thanks PH on the addition that people can use. That along with the changes that were made since the initial post show how scripts change. The snippet below is a replacement for part of the code to display sector fighters/armids/limpet and give the time the sector was last viewed. If anyone want this, just search for the if statement, copy the below, and then paste over the original (if to end).

... and I didn't do a very good job of cropping the picture.. the top line went with the previous sector.

Attachment:
planetdispsm.png
planetdispsm.png [ 20.45 KiB | Viewed 9529 times ]


Code:
   if ($sectorChng <> $sector[$dispCnt])
         echo ansi_9 "------------------------------------------------------------------------------*"
      getword SECTOR.UPDATED[$sectorChng] $moDay 1
      getLength $moDay $len
      cutText $moDay $moDay 1  ($len - 5)
      getword SECTOR.UPDATED[$sectorChng] $hhmm 2
      getword SECTOR.UPDATED[$sectorChng] $amPM 3
      echo ansi_6 "  Sector Figs:  " SECTOR.FIGS.QUANTITY[$sectorChng]
      echo "  Armd: " SECTOR.MINES.QUANTITY[$sectorChng]
      echo "  Lmpt: " SECTOR.LIMPETS.QUANTITY[$sectorChng]
      echo "  Last: " $moDay " " $hhmm " " $amPM "*"
      echo ansi_9 "------------------------------------------------------------------------------*"
      setVar $sectorChng $sector[$dispCnt]
   end

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Wed Dec 30, 2009 6:52 pm
Profile ICQ
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: PlanetDisplay.ts
Why does the DATE Show but "0" "0" for time if I have never visited?

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Thu Dec 31, 2009 12:24 am
Profile ICQ YIM
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: PlanetDisplay.ts
Parrothead wrote:
Why does the DATE Show but "0" "0" for time if I have never visited?


That is a good question and one I can't answer except for a guess. I am pulling the last visit from TWX's database, so as a guess, the field gets populated when the database is created with the date - I really don't know. I am just happy that it didn't crash because I hadn't tested against that.

I probably should test to see if $hhmm is a number and if so then set a var to display "Never Visited" or something to that effect.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Thu Dec 31, 2009 12:56 am
Profile ICQ
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: PlanetDisplay.ts
Getting some raw ansi code in some games echoing ":35]"


It showed todays date but no time in other issue

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Thu Dec 31, 2009 2:49 am
Profile ICQ YIM
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: PlanetDisplay.ts
I add distance from current sector to my copy

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Fri Jan 08, 2010 12:15 am
Profile ICQ YIM
Display posts from previous:  Sort by  
Reply to topic   [ 17 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.