ScriptUO

Scripting Resources & Utilities => Stealth Client => Topic started by: sharpie on September 18, 2018, 02:39:06 PM

Title: [Python] How to access the current time
Post by: sharpie on September 18, 2018, 02:39:06 PM
Hi! I've been learning Stealth/Python and I've run into a snag. I can't seem to figure out how to actually make a variable with the current time. Most of the stuff in the API gives me name 'xyz' is not defined. I'm sure there's an easy way!

Ex:

I'm trying to use Now in the WaitJournalLine command.

findMsg = WaitJournalLine(Now(), endMsg + "|" + stopMsg, 25000)
Title: Re: [Python] How to access the current time
Post by: ZeroDX on September 18, 2018, 09:07:08 PM
Code: [Select]
import datetime

now = datetime.datetime.now()
findMsg = WaitJournalLine(now, endMsg + "|" + stopMsg, 25000)

Code: [Select]
from datetime import datetime as dt

findMsg = WaitJournalLine(dt.now(), endMsg + "|" + stopMsg, 25000)
Title: Re: [Python] How to access the current time
Post by: sharpie on September 19, 2018, 12:13:14 AM
Thank you!!