Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
miegorengman
Wanderer


Joined: 05 Sep 2008
Posts: 51

PostPosted: Thu Apr 27, 2023 7:15 pm   

how to use lua
 
There is a handy time script written in LUA that would allow me to translate game times into real time...and I have no background in LUA and learned most of my scripting from reading the CMUD manual...so I am trying to see if I can get some help successfully using the script....or maybe some help understanding the math behind it so I can translate the entire script into zScript.

the script can be found at https://github.com/missionz3r0/Dartmud-Lua-Scipts/blob/eae80bcb25bd4ab5649492482bae53ae3933efa7/Scripts/date.lua


Here is an example line to trigger from, the date reading [Month Day, Year].

106 [Vio 12, 1696] Too weak to lift it? Hire me!


so if I wanted the script to take [Vio 12, 1696] and output somthing like [1/1/2001], how would i need to configure the trigger?

thank you for your time :)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4689
Location: Pensacola, FL, USA

PostPosted: Wed May 03, 2023 3:36 am   
 
You should be able to just stick all of that inside a #LUA command.

Search the help system for 'lua' to see how to reference CMUD variables inside the code.

As for your closing question... I have no clue which month number Vio is supposed to be. You would need to make your own reference table to convert that.
_________________
Discord: Shalimarwildcat
Reply with quote
mikeC130
Apprentice


Joined: 03 Jul 2006
Posts: 110

PostPosted: Wed May 03, 2023 8:24 pm   
 
That program doesn't appear to do what he wants to do. From my (very limited) understanding of the code, it takes a time (in seconds as far as I can tell, though I can't say what the zero reference is) and calculates a "reckoning" date based on the length the chosen system's day, month, and year in seconds. To translate the opposite way, you would need to determine the dating system, presumably from the month name ("vio" is the 7th month out of an 8 month Thorpian year, with each month being 4 "Earth" days and a year being 32 days), and then calculate the number of seconds that have elapsed from the baseline per the date listed. It doesn't seem that cmud has a function to return a date based on elapsed time entered, however, so a system would need to be created to determine the number of days passed (including perhaps the irregular adding of "leap seconds") and using that to calculate the current date, including the adding of a leap day every 4 years.

Mike
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net