Hey all. I wrote this up to teach myself how to play with separating and combining strings. I'm sure there are subs out there that do this already, but figured I'd share this anyways.
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; Script Name: Raz's Time Getter Sub
; Author: Razeial
; Version: 1.0
; Purpose: Gives a value of time in the format of 00:00 AM/PM
;
;Instructions: Place this sub in your script. The variable %time is used for the return value.
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SUB GetTime
set %time #time
if #time < 130000
{
if #time >= 120000 && #time < 130000
{
str left %time 4
set %time #strres
str left %time 2
set %time1 #strres
str right %time 2
set %time2 #strres
set %time %time1 , : , %time2 , #spc , PM
}
if #time >= 000000 && #time < 010000
{
str right %time 4
set %time1 #strres
str left %time1 2
set %time2 #strres
set %time 12 , : , %time2 , #spc , AM
display %time
}
if #time < 100000 && #time >= 010000
{
str left %time 4
set %time #strres
str mid %time 2 3 4
set %time #strres
str left %time 1
set %time1 #strres
str right %time 2
set %time2 #strres
set %time %time1 , : , %time2 , #spc , AM
}
if #time < 120000 && #time >= 100000
{
str left %time 4
set %time #strRes
str left %time 2
set %time1 #strres
str right %time 2
set %time2 #strres
set %time %time1 , : , %time2 , #spc , AM
}
}
if #time > 130000
{
if #time > 195959
{
str left %time 4
set %time #strRes
str left %time 2
set %time1 #strres - 12
str right %time 2
set %time2 #strres
set %time %time1 , : , %time2 , #spc , PM
}
if #time < 095959 && #time > 120000
{
set %time #time - 120000
str left %time 3
set %time #strres
display %time
str left %time 1
set %time1 #strres
str right %time 2
set %time2 #strres
set %time %time1 , : , %time2 , #spc , PM
}
}
return