www.ClassicTW.com
http://classictw.com/

Automated BigBang for TWX Proxy!
http://classictw.com/viewtopic.php?f=15&t=35911
Page 1 of 1

Author:  Micro [ Sun Mar 12, 2023 5:59 pm ]
Post subject:  Automated BigBang for TWX Proxy!

Automated BigBang for TWX Proxy:

Code:

echo "**Automated BigBang.**"

#Get game letter from TWX Database (Setup Screen)
#$Game := GAME

#or set manually
$Game := "z"

#Note: Leading Zeros are required, and time is
#      military (00-23 with no AM/PM)
$StartDate := "03/11/2023"
$StartTime := "21:00"

:Wait
getDate $Date
splitText $Date $D "/"
$Month := $D[1]
$Day := $D[2]
$Year := $D[3]

getTime $Time
splitText $Time $T ": "
$Hour := $T[1]
$Minute := $T[2]
$Seconds := $T[3]
$AmPm := $T[4]

echo "*The time is " $Hour ":" $Minute " " $AmPm " Waiting Until 8:00 PM to run BigBang.*"

if ($Hour = 8) and ($Minute = "00") and ($AmPm = "PM")
   goto :Start
end

#Wait 1 minute before checking again
setDelayTrigger TO :Wait 60000
pause

:Start

if (CONNECTED)
    disconnect
end

setDelayTrigger    TO :Start 60000
setTextTrigger T4 :Login "Please enter your name"
setTextTrigger T3 :SelMenu "Selection (? for menu):"
connect
pause

:Login
    send NAME "*" PASSWORD "*"
    pause

:SelMenu
    killAllTriggers

    #Take Game Offline

    setTextTrigger A1 :Active "as INACTIVE.  Are you sure?"
    setTextTrigger A2 :Inactive "as ACTIVE.  Are you sure?"
    send #42 "9" $Game
    pause
   
    :Active
    send "yq"
    goto :BigBang
   
    :Inactive
    send "n*q"
    goto :BigBang
   
    :BigBang
    killAllTriggers
    #Run BigBang
    send "B" $Game "ya"
    waitFor "BigBang Setup"

    #Set new Random Seed
    send "r*0*"
    waitFor "BigBang Setup"

    #Start BigBang
    send "z*"
    # Using WaitON, because we want to capture the line.
    WaitOn "This BigBang generation"
    $Finished := CURRENTLINE

    # But waitfor is required for prompts:
    waitfor "Selection (? for menu):"

    #Activate Game
    #send #42 "9" $Game "yq"

    # -=- OR -=-

    #Schedule Game Start
    send #42 "0" $Game $StartDate "*" $StartTime "*"
    waitfor "Game will start on"

    echo "** -=- " $Finished "*"
disconnect

#Wait 1 to make sure it doesn't fire immediatly
setDelayTrigger TO :Wait 60000
pause

Author:  Micro [ Thu Mar 16, 2023 6:20 pm ]
Post subject:  Re: Automated BigBang for TWX Proxy!

To Simplify the above code, I have added two additional commands:

dateTimeAdd - Increments the Unix/Julian Datetimes by specified amount.
getDateOnly - Retrieves the current Unix/Julian Date Only.

You can also get parts of a Unix/Julian Datetime:
Code:
getDateTime $var
echo "Today is " $var.NameOfWeekDay 
echo " which is the " $var.DayOfWeek "th Day of the week.*"
See the Wiki for details:
https://github.com/TW2002/twxp/wiki/What%27s-New%21

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