View unanswered posts | View active topics It is currently Thu Apr 23, 2026 3:32 am



Reply to topic  [ 12 posts ] 
 SysOp Intro.ANS Time Stamp 
Author Message
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post SysOp Intro.ANS Time Stamp
A simple script to place the server time in your intro.ans file that does not require you to be logged into the twgs but does require that you are local to the server.

An example of the output of this script maybe be viewed on rivercitytw.dlinkddns.com port 2002

Precaution: Before running this script, backup your Intro.ans file!! Also make sure you have at least two blank lines for it to write the time stamp.

# update Intro.ANS with current time

setVar $intro "c:\program files\epic interactive strategy\twgs\intro.ans"

fileExists $exists $intro

if ($exists = FALSE)
clientMessage "Please check the path, File Not Found at:"
clientMessage $intro
halt
end

goto :ansiTimer
:begin
setDelayTrigger ansitimer :ansitimer 30000
pause

:ansitimer

setVar $i 1
read $intro $line $i
while ($line <> EOF)
setVar $fileLine[$i] $line
add $i 1
read $intro $line $i
end
subtract $i 1

setVar $iWrite 1
delete $intro
while ($iWrite <= $i)

# the line below will write time 2 lines above the "Selection (? for menu):"

if ($iWrite = ($i - 2))
getTime $curTime "h:mm:ss am/pm"
upperCase $curTime

# The site does not allow me to paste the correct color codes: Copy the square from an ANSI
# file (using notepad) and paste it before the [ brackets in the line below

write $intro "  Server Time: " & $curTime & " Updated every 30 seconds"
add $iWrite 1
end
write $intro $fileLine[$iWrite]
add $iWrite 1
end

goto :begin

_________________
               / Promethius / Enigma / Wolfen /

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


Sun Oct 26, 2008 6:05 pm
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: SysOp Intro.ANS Time Stamp
Any chance of adding the zone? For example, I am PST, others may be Central, etc.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sun Oct 26, 2008 11:49 pm
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: SysOp Intro.ANS Time Stamp
Thrawn wrote:
Any chance of adding the zone? For example, I am PST, others may be Central, etc.


Easiest way would be to hard code the time zone in front of the "Updated every 30 seconds" write. Something like " PST, Updated every 30 seconds".

_________________
               / Promethius / Enigma / Wolfen /

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


Mon Oct 27, 2008 12:22 am
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: SysOp Intro.ANS Time Stamp
Thanks. I will do that.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Oct 27, 2008 10:53 am
Profile
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: SysOp Intro.ANS Time Stamp
I ran into an interesting development on my end.

The script ran great. It added the time stamp every 30 secs. However I noticed after a bit, it defaulted to the default menu (the same menu style as if you log in admin). I had to stop and restart my TWGS to get the ANSI screen to display.

Now I set the timestamp script to run with the ScoreKeeper, which runs our WhoIsOnline script. Both do their thing every 30 seconds. The WhoIsOnline posts to HTML, and the timestamp posts to the ANSI screen. Should I be running the timestamp script alone? Or is this a TWGS bug?

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Oct 27, 2008 3:00 pm
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: SysOp Intro.ANS Time Stamp
Thrawn wrote:
I ran into an interesting development on my end.

The script ran great. It added the time stamp every 30 secs. However I noticed after a bit, it defaulted to the default menu (the same menu style as if you log in admin). I had to stop and restart my TWGS to get the ANSI screen to display.

Now I set the timestamp script to run with the ScoreKeeper, which runs our WhoIsOnline script. Both do their thing every 30 seconds. The WhoIsOnline posts to HTML, and the timestamp posts to the ANSI screen. Should I be running the timestamp script alone? Or is this a TWGS bug?


I am wondering if TWGS did a read of the ANSI screen during the time the file was deleted and rewritten. It didn't find it so it may have defaulted back to the other menu. It would seem to have taken an extreme coincidence for this to happen because the delete and write happens extremely fast. I will look at maybe another option.

_________________
               / Promethius / Enigma / Wolfen /

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


Mon Oct 27, 2008 5:44 pm
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: SysOp Intro.ANS Time Stamp
I was going to ask you that same thought. The ScoreKeeper is logged in and sits at the menu, pressing # every # seconds and writes to the Who's Online HTML file. I'm wondering if it is causing the problem where the timestamp script goes to write to the ansi screen and the ScoreKeeper is sitting at the menu at that exact time, although the screen displayed shows the players online, not the actual ansi screen.

I will try running the timestamp in a seperate twxproxy and the scorekeeper in another to see if this issue will reproduce.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Oct 27, 2008 6:52 pm
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: SysOp Intro.ANS Time Stamp
Thrawn wrote:
I was going to ask you that same thought. The ScoreKeeper is logged in and sits at the menu, pressing # every # seconds and writes to the Who's Online HTML file. I'm wondering if it is causing the problem where the timestamp script goes to write to the ansi screen and the ScoreKeeper is sitting at the menu at that exact time, although the screen displayed shows the players online, not the actual ansi screen.

I will try running the timestamp in a seperate twxproxy and the scorekeeper in another to see if this issue will reproduce.


No need to try and reproduce, as I just saw it happen. Ah well, the thought sounded good on it.

_________________
               / Promethius / Enigma / Wolfen /

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


Mon Oct 27, 2008 7:15 pm
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: SysOp Intro.ANS Time Stamp
It did not produce the issue if I don't have the ScoreKeeper running. If it is online at the menu or a player is accessing the menu at the same time, then it causes the TWGS to use the default menu. Your idea is sound "if" this error was fixed on the TWGS side.

Of course it would be nice if the TWGS allowed us to use specific codes like we do with our BBS software. A certain code on the ansi screen displays time, etc. Sorry if I ruined your idea.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Oct 27, 2008 7:21 pm
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: SysOp Intro.ANS Time Stamp
Thrawn wrote:
It did not produce the issue if I don't have the ScoreKeeper running. If it is online at the menu or a player is accessing the menu at the same time, then it causes the TWGS to use the default menu. Your idea is sound "if" this error was fixed on the TWGS side.

Of course it would be nice if the TWGS allowed us to use specific codes like we do with our BBS software. A certain code on the ansi screen displays time, etc. Sorry if I ruined your idea.


lol, stuff happens. It was fun to mess with but just one of those things..........

_________________
               / Promethius / Enigma / Wolfen /

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


Mon Oct 27, 2008 7:53 pm
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: SysOp Intro.ANS Time Stamp
TWX could corrupt an ANSI file since it might mis-interpret line breaks. I don't imagine it could reliably read and then write an ANSI file, or at least not all ANSI files.

Quote:
# The site does not allow me to paste the correct color codes: Copy the square from an ANSI
# file (using notepad) and paste it before the [ brackets in the line below

write $intro "  Server Time: " & $curTime & " Updated every 30 seconds"


That is an Escape sequence. Escape sequences begin with #27 (the ESC key code) and [ (open bracket). So the above line should be written:
write $intro #27 & "[37m  Server Time: " & #27 & "[34m" & $curTime & #27 & "[37m Updated every 30 seconds"

+EP+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue Oct 28, 2008 6:01 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: SysOp Intro.ANS Time Stamp
I wrote a script that interprets a limited set of ANSI codes for a player score to HTML parser. I just stripped out any codes I didn't like. Writing ANSI would be trickier since you probably can't write all of the escape codes, but if you stripped out the problems ahead of time it might work... mostly.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Tue Oct 28, 2008 8:12 pm
Profile ICQ WWW
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

Users browsing this forum: No registered users and 30 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.