Author Topic: Raz's Time Getter Sub  (Read 4758 times)

0 Members and 1 Guest are viewing this topic.

Offline razeialTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 1
  • razeial has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Raz's Time Getter Sub
« on: August 27, 2012, 06:39:24 PM »
0
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.

Code: [Select]
;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

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Raz's Time Getter SUB.txt

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Raz's Time Getter Sub
« Reply #1 on: August 27, 2012, 07:28:40 PM »
0
Congratulations your Script has been moved to the script library
(if you dont think the section is appropriate please pm me)
Thank you for your submission
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Tags: