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

SysOp Script - proGameOpen on GrimyTrader.com
https://mail.black-squirrel.com/viewtopic.php?f=15&t=20649
Page 1 of 2

Author:  Promethius [ Mon May 26, 2008 1:38 pm ]
Post subject:  SysOp Script - proGameOpen on GrimyTrader.com

The script allows the sysOp to open games at a preset time.

Bang a closed game, log in through admin, start the script and select the game(s) to open, set the hour, set the minutes (two digit) and select start.

Eliminate RL from preventing your opening your games at the advertised time.

Author:  V'Ger [ Mon May 26, 2008 3:21 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Prom,

This is a great tool, I used the one you sent me to open up my bangs on Saturday night. Worked like a charm.

Thanks.

~V

Author:  Y City Connection [ Mon May 26, 2008 7:57 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Thanks starting using it today, works great!

Author:  Daala [ Mon May 26, 2008 10:25 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Thank you Prom for the script. We had one setup here before Thrawn left and it works great. Just passing my thanks to you. Makes it easy for this wife to run the TWGS. ;)

Author:  V'Ger [ Sun Jun 01, 2008 10:00 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Prom-

The script does work great, but after some thought two quick tweaks for this script could make it better.

The first is putting an option for people who use Local TEDIT passwords. I have it set up on ICE for some reason, and a lot of my scripts are tailored to it, so it would be a pain to change it. If not, this is no big deal, I wrote a little script that waits for the PW prompt and sends the pw anyway, and it works as a work around, but would be nice if it is integrated.

The second is if the script would close the instance of TWX since it isn't needed anymore. Someone here helped me with the coding for that, and it is:

Code:
openMenu TWX_EXIT FALSE


I have a delay trigger in front of it in my scripts for some reason, I think it wasn't working properly without it. But the script cleaning itself up would be nice.

Thanks for listening. :D

Author:  Promethius [ Sun Jun 01, 2008 10:35 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

V'Ger wrote:
Prom-

The script does work great, but after some thought two quick tweaks for this script could make it better.

The first is putting an option for people who use Local TEDIT passwords. I have it set up on ICE for some reason, and a lot of my scripts are tailored to it, so it would be a pain to change it. If not, this is no big deal, I wrote a little script that waits for the PW prompt and sends the pw anyway, and it works as a work around, but would be nice if it is integrated.

The second is if the script would close the instance of TWX since it isn't needed anymore. Someone here helped me with the coding for that, and it is:

Code:
openMenu TWX_EXIT FALSE


I have a delay trigger in front of it in my scripts for some reason, I think it wasn't working properly without it. But the script cleaning itself up would be nice.

Thanks for listening. :D


Thanks for the info on that. I will see what I can do on it.

Author:  Promethius [ Mon Jun 02, 2008 12:08 am ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

I added a disconnect and the close of TWX, but I am wondering if it would be that much of an advantage since every time I close TWX, I get the Windows error message and have to close that. Regardless the script code is below for anyone who wants/needs to add additional tweaks.

Code:
# automatically open closed games
# Log into through Admin mode and run
# a kludge of a script by Promethius, but it works
# proGameOpen.ts


setVar $games "Not Set"
setVar $time "Not Set"
setVar $close "No"

:menu
echo ANSI_11 "**(1)  Enter the game(s) to be opened.         " ANSI_15 $games
echo ANSI_11 "*(2)  Enter the time to be opened.             " ANSI_15 $time
echo ansi_11 "*(3)  Disconnect and Close TWX when completed? " ANSI_15 $close
echo ANSI_13 "*(S)  Start script"
echo ANSI_12 "*(Q)  Abort script*"
getConsoleInput  $menuChoice singlekey
lowercase $menuChoice

if ($menuChoice = 1)
   setVar $games ""
   setVar $i 1
   setVar $cnt 1
   while ($i <> 0)
     echo ansi_12 "*Enter Game Letter for game " ANSI_15 $cnt ANSI_12 " to open or" ansi_9 " 0 " ANSI_12 "to finish"
     echo ansi_12 "*Current game(s) to open:  " ANSI_15 $games "*"
     getConsoleInput  $i singlekey
     add $cnt 1
     if ($i <> 0)
        setVar $games $games & $i & " "
     else
        goto :menu
     end
   end
elseif ($menuChoice = 2)
     echo "*Enter the hour to open the game and press enter"
     getConsoleInput $hour
     echo "*Enter the minutes to open the game in mm (00, 30)"
     getConsoleInput $minutes
     echo "*Enter is this AM or PM (a/p)?"
     getConsoleInput $amPM singlekey
     setVar $time $hour & ":" & $minutes & " " & $amPM
elseif ($menuChoice = 3)
     if ($close = "No")
        setVar $close "Yes"
     else
        setVar $close "No"
     end
elseif ($menuChoice = "s") and ($time <> "Not Set") and ($games <> "Not Set")
     send "?"
     goto :begin
elseif ($menuChoice = "q")
     halt
end
goto :menu

:begin
  gettime $now "h mm a/p"
  getword $now $nowHour 1
  getword $now $nowMin 2
  getWord $now $nowAP 3
  if ($nowhour = $hour) and ($nowMin >= $minutes) and ($nowAP = $amPM)
     goto :opengames
  else
     setDelayTrigger delay :myDelay 10000
     pause
     :myDelay
     send "?"
     goto :begin
  end

  :opengames
   killtrigger myDelay
   setVar $arrayCnt 1
   getword $games $gameLetter $arrayCnt
   while ($gameLetter <> 0)
   send $gameLetter
   setTextTrigger inEdit :inEdit "Trade Wars 2002 Editor"
   pause
   :inEdit
   send "h"
   waitfor "General Editor Two"
   send "["
   waitfor "Should this be a"
   send "n"
    waitfor "General Editor Two"
    send "q"
    waitfor "Trade Wars 2002 Editor"
    send "q"
    setTextTrigger adminMenu :adminMenu "Selection (?"
    pause
    :adminMenu
    add $arrayCnt 1
    getWord $games $gameLetter $arrayCnt
   end
   if ($close = "Yes")
      disconnect
      openMenu TWX_EXIT FALSE
   end


Author:  V'Ger [ Mon Jun 02, 2008 7:14 am ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Prom,

Weird, its not giving me any error message... wait come to think of it, I think it is because I am using a slightly different version of TWX. Probably in the next release where that error message has been resolved, it shouldn't be a problem.

Thanks for looking into it :o

Author:  Daala [ Mon Jun 02, 2008 9:40 am ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

I use the same script, and I have been playing with it to add the Local TEDIT pasword, but keep getting errors.

May I ask where I would add the lines to tell it to enter the password? I had the following but got an error:

----

send $gameLetter
waitfor "Password? "
send "*******"
setTextTrigger inEdit :inEdit "Trade Wars 2002 Editor"

----

I took out the "waitfor" line thinking it would send the password but still nothing. As V'Ger stated, it would be great to incorporate the option. I tried to write a systemscript, but failed at that.

Author:  Promethius [ Mon Jun 02, 2008 10:59 am ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Daala wrote:
I use the same script, and I have been playing with it to add the Local TEDIT pasword, but keep getting errors.

May I ask where I would add the lines to tell it to enter the password? I had the following but got an error:

----

send $gameLetter
waitfor "Password? "
send "*******"
setTextTrigger inEdit :inEdit "Trade Wars 2002 Editor"

----

I took out the "waitfor" line thinking it would send the password but still nothing. As V'Ger stated, it would be great to incorporate the option. I tried to write a systemscript, but failed at that.


I really don't know anything about local Tedit. I have set a password on a game, but TWGS still lets me in it w/o the password after I log into the admin port.
I always telnet into the server. (Use game passwords is checked and a password is set for the game)

If you are using the same password for each game then a: send $gameLetterPword "*" where $gameLetterPword is set to that password would appear to work. If you use different passwords for the games then the script will have to be modified to associate the correct password with the game.

Author:  Daala [ Mon Jun 02, 2008 12:21 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Promethius wrote:
Daala wrote:
I use the same script, and I have been playing with it to add the Local TEDIT pasword, but keep getting errors.

May I ask where I would add the lines to tell it to enter the password? I had the following but got an error:

----

send $gameLetter
waitfor "Password? "
send "*******"
setTextTrigger inEdit :inEdit "Trade Wars 2002 Editor"

----

I took out the "waitfor" line thinking it would send the password but still nothing. As V'Ger stated, it would be great to incorporate the option. I tried to write a systemscript, but failed at that.


I really don't know anything about local Tedit. I have set a password on a game, but TWGS still lets me in it w/o the password after I log into the admin port.
I always telnet into the server. (Use game passwords is checked and a password is set for the game)

If you are using the same password for each game then a: send $gameLetterPword "*" where $gameLetterPword is set to that password would appear to work. If you use different passwords for the games then the script will have to be modified to associate the correct password with the game.


Thank you for the assistance. I had modified my first attempt and had something similar. I forgot to add the line to set the var assigned for the password. Then instead of the $ I had typed the # by mistake. Now it works great.

The Local TEDIT allows us to set a password for game-ops. When used, they are limited in what they can access, compared to the Global password access. With using the ScoreKeeper, we like it on the local password access so it can't affect other settings by mistake, as Thrawn's first full run of it had caused.

Appreciate your taking time to help me out.

Author:  Daala [ Sun Jun 08, 2008 10:18 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

I am wondering if this script not only can have the time input, but a date input as well? The reason I am asking is with us automating our site we can have our ScoreKeeper load the script and fill in the date/time and then it will sit until that date/time is reached to open the game. If so, would you be willing to show me exactly where to add?

Author:  Promethius [ Sun Jun 08, 2008 10:39 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Daala wrote:
I am wondering if this script not only can have the time input, but a date input as well? The reason I am asking is with us automating our site we can have our ScoreKeeper load the script and fill in the date/time and then it will sit until that date/time is reached to open the game. If so, would you be willing to show me exactly where to add?


I "think" the following would work:

setVar $atDate 0
# menu
echo "Enter month mm"
getConsoleInput $month
echo "Enter day dd (01, 10 etc)"
getConsoleInput $dayOfMonth
# getTime $dateString "mm dd"

# after :begin
if ($atDate = 0)
getTime $dateString "mm dd"
getword $dateString $mm 1
getword $dateString $dd 2
if ($mm = $month) and ($dd = $dayOfMonth)
setVar $atDate 1
end
end

# I added the "and ($atDate = 1)" to the following string

if ($nowhour = $hour) and ($nowMin >= $minutes) and ($nowAP = $amPM) and ($atDate = 1)

Author:  Daala [ Mon Jun 09, 2008 9:47 am ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Promethius wrote:
Daala wrote:
I am wondering if this script not only can have the time input, but a date input as well? The reason I am asking is with us automating our site we can have our ScoreKeeper load the script and fill in the date/time and then it will sit until that date/time is reached to open the game. If so, would you be willing to show me exactly where to add?


I "think" the following would work:

setVar $atDate 0
# menu
echo "Enter month mm"
getConsoleInput $month
echo "Enter day dd (01, 10 etc)"
getConsoleInput $dayOfMonth
getTime $dateString "mm dd"

# after :begin
if ($atDate = 0)
getword $dateString $mm 1
getword $dateString $dd 2
if ($mm = $month) and ($dd = $dayOfMonth)
setVar $atDate 1
end
end

# I added the "and ($atDate = 1)" to the following string

if ($nowhour = $hour) and ($nowMin >= $minutes) and ($nowAP = $amPM) and ($atDate = 1)


Thank you. It worked perfectly. I slid the "# menu" code you supplied in the "($menuChoice = 2)" right after entering the time section and ran it. When you enter the variables and are ready to run the script, it shows the time you input, the game(s), but does not show the date. No big issue. This script also uses the LOCAL TEDIT password option.

If interested, here is the code:

-----
Code:

# automatically open closed games
# Log into through Admin mode and run
# a SysOp script by Promethius


setVar $games "Not Set"
setVar $time "Not Set"
setVar $atDate 0

:menu
echo ANSI_11 "**(1)  Enter the game(s) to be opened. "  ANSI_15 $games
echo ANSI_11 "*(2)  Enter the time to be opened.  " ANSI_15 $time
echo ANSI_13 "*(S)  Start script"
echo ANSI_12 "*(Q)  Abort script*"
getConsoleInput  $menuChoice singlekey
lowercase $menuChoice

if ($menuChoice = 1)
   setVar $games ""
   setVar $i 1
   setVar $cnt 1
   while ($i <> 0)
     echo ansi_12 "*Enter Game Letter for game " ANSI_15 $cnt ANSI_12 " to open or" ansi_9 " 0 " ANSI_12 "to finish"
     echo ansi_12 "*Current game(s) to open:  " ANSI_15 $games "*"
     getConsoleInput  $i singlekey
     add $cnt 1
     if ($i <> 0)
        setVar $games $games & $i & " "
     else
        goto :menu
     end
   end
elseif ($menuChoice = 2)
     echo "*Enter the hour to open the game and press enter"
     getConsoleInput $hour
     echo "*Enter the minutes to open the game in mm (00, 30)"
     getConsoleInput $minutes
     echo "*Enter is this AM or PM (a/p)?"
     getConsoleInput $amPM singlekey
     setVar $time $hour & ":" & $minutes & " " & $amPM
     echo "Enter month mm"
     getConsoleInput $month
     echo "Enter day dd (01, 10 etc)"
     getConsoleInput $dayOfMonth
     getTime $dateString "mm dd"
elseif ($menuChoice = "s") and ($time <> "Not Set") and ($games <> "Not Set")
     send "?"
     goto :begin
elseif ($menuChoice = "q")
     halt
end
goto :menu

:begin
  gettime $now "h mm a/p"
  getword $now $nowHour 1
  getword $now $nowMin 2
  getWord $now $nowAP 3
  if ($atDate = 0)
  getword $dateString $mm 1
  getword $dateString $dd 2
  if ($mm = $month) and ($dd = $dayOfMonth)
  setVar $atDate 1
  end
  end
  if ($nowhour = $hour) and ($nowMin >= $minutes) and ($nowAP = $amPM) and ($atDate = 1)
     goto :opengames
  else
     setDelayTrigger delay :myDelay 10000
     pause
     :myDelay
     send "?"
     goto :begin
  end

  :opengames
   killtrigger myDelay
   setVar $arrayCnt 1
   setVar $gameLetterPword "*****"
   getword $games $gameLetter $arrayCnt
   while ($gameLetter <> 0)
   send $gameLetter
   waitfor "Password?"
   send $gameLetterPword "*"
   setTextTrigger inEdit :inEdit "Trade Wars 2002 Editor"
   pause
   :inEdit
   send "h"
   waitfor "General Editor Two"
   send "["
   waitfor "Should this be a"
   send "n"
    waitfor "General Editor Two"
    send "q"
    waitfor "Trade Wars 2002 Editor"
    send "q"
    setTextTrigger adminMenu :adminMenu "Selection (?"
    pause
    :adminMenu
    add $arrayCnt 1
    getWord $games $gameLetter $arrayCnt
   end


----

Author:  Promethius [ Mon Jun 09, 2008 12:37 pm ]
Post subject:  Re: SysOp Script - proGameOpen on GrimyTrader.com

Daala wrote:
Promethius wrote:
Daala wrote:
I am wondering if this script not only can have the time input, but a date input as well? The reason I am asking is with us automating our site we can have our ScoreKeeper load the script and fill in the date/time and then it will sit until that date/time is reached to open the game. If so, would you be willing to show me exactly where to add?


-----
# automatically open closed games
# Log into through Admin mode and run
# a SysOp script by Promethius


setVar $games "Not Set"
setVar $time "Not Set"
setVar $atDate 0

:menu
echo ANSI_11 "**(1) Enter the game(s) to be opened. " ANSI_15 $games
echo ANSI_11 "*(2) Enter the time to be opened. " ANSI_15 $time
if ($time <> "Not Set")
echo " on " $month "/" $dayOfMonth
end

echo ANSI_13 "*(S) Start script"
echo ANSI_12 "*(Q) Abort script*"
getConsoleInput $menuChoice singlekey
lowercase $menuChoice

if ($menuChoice = 1)
setVar $games ""
setVar $i 1
setVar $cnt 1
while ($i <> 0)
echo ansi_12 "*Enter Game Letter for game " ANSI_15 $cnt ANSI_12 " to open or" ansi_9 " 0 " ANSI_12 "to finish"
echo ansi_12 "*Current game(s) to open: " ANSI_15 $games "*"
getConsoleInput $i singlekey
add $cnt 1
if ($i <> 0)
setVar $games $games & $i & " "
else
goto :menu
end
end
elseif ($menuChoice = 2)
echo "*Enter the hour to open the game and press enter"
getConsoleInput $hour
echo "*Enter the minutes to open the game in mm (00, 30)"
getConsoleInput $minutes
echo "*Enter is this AM or PM (a/p)?"
getConsoleInput $amPM singlekey
setVar $time $hour & ":" & $minutes & " " & $amPM
echo "Enter month mm"
getConsoleInput $month
echo "Enter day dd (01, 10 etc)"
getConsoleInput $dayOfMonth
# getTime $dateString "mm dd"
elseif ($menuChoice = "s") and ($time <> "Not Set") and ($games <> "Not Set")
send "?"
goto :begin
elseif ($menuChoice = "q")
halt
end
goto :menu

:begin
gettime $now "h mm a/p"
getword $now $nowHour 1
getword $now $nowMin 2
getWord $now $nowAP 3
if ($atDate = 0)
getTime $dateString "mm dd"
getword $dateString $mm 1
getword $dateString $dd 2
if ($mm = $month) and ($dd = $dayOfMonth)
setVar $atDate 1
end
end
if ($nowhour = $hour) and ($nowMin >= $minutes) and ($nowAP = $amPM) and ($atDate = 1)
goto :opengames
else
setDelayTrigger delay :myDelay 10000
pause
:myDelay
send "?"
goto :begin
end

:opengames
killtrigger myDelay
setVar $arrayCnt 1
setVar $gameLetterPword "*****"
getword $games $gameLetter $arrayCnt
while ($gameLetter <> 0)
send $gameLetter
waitfor "Password?"
send $gameLetterPword "*"
setTextTrigger inEdit :inEdit "Trade Wars 2002 Editor"
pause
:inEdit
send "h"
waitfor "General Editor Two"
send "["
waitfor "Should this be a"
send "n"
waitfor "General Editor Two"
send "q"
waitfor "Trade Wars 2002 Editor"
send "q"
setTextTrigger adminMenu :adminMenu "Selection (?"
pause
:adminMenu
add $arrayCnt 1
getWord $games $gameLetter $arrayCnt
end

----


I missed the line to update the date string in the example I used. The getTime $dateString "mm dd" needed to be in the if ($atdate = 0) check to update the date. I added it to your code above along with displaying the month and day of month in the menu the game will be opened. Changes are in red.

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