Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Trial period function with an array

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Sep 22, 2015 10:48 pm    Post subject: Trial period function with an array Reply with quote

I try to make a trial period function with "stupid way", but i think this is effective and it's also avoid user to changing their os.date().

I need to substitute "if else" command with "for do" for an array here.
Does some one could fix it ?

Code:

date_check = os.date("%x")
date_count = {[0]='09/23/15', '09/24/15', '09/25/15', '09/26/15'}
date_start = tostring(date_check)
---------------------------------------- Need change this section with "for - do" command
---------------------------------------- to use array string date above
if date_start == date_count[0] then
print("Ok..")
else
print("trial over..")
end


And here is other trial function by manipulating os.time()

Code:

time_start = 1442981349  ---- os.time() for 09/23/2015
time_end = 1443240646    ---- os.time() for 09/26/2015
time_trial_check=tonumber(os.time())
if time_trial_check < time_start or time_trial_check > time_end then
print("Trial Over")
else
print("ok..Still goes on")
end


regards


Last edited by Corroder on Mon Oct 05, 2015 6:20 am; edited 1 time in total
Back to top
View user's profile Send private message
Stephen Yang
Newbie cheater
Reputation: 0

Joined: 22 Feb 2015
Posts: 14

PostPosted: Wed Sep 30, 2015 1:16 am    Post subject: Reply with quote

how can i calculate the number 1442981349 for 09/23/2015 and 1443240646 for 09/26/2015
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25814
Location: The netherlands

PostPosted: Wed Sep 30, 2015 4:25 am    Post subject: Reply with quote

it's the number of seconds since the "epoch"

http://www.timestampconvert.com

(and i'm sure lua has a way to deal with this as well)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Wed Sep 30, 2015 7:08 am    Post subject: Reply with quote

Code:

-- from date to time, use a table specification, zero-base or 1-base as common usage,ie. hour-min-sec is zero base, year-month-day is 1-base. http://www.lua.org/manual/5.1/manual.html#pdf-os.date
local t = os.time( {year=1999;month=12;day=31} )
local now = os.time() -- current time if no specification
print("=== from time to date, use format string as http://www.tutorialspoint.com/c_standard_library/c_function_strftime.htm  ")
print("=== 1999-12-31, t=", t)
print(os.date("time: %c",t))

print("=== now, t=", now)
print(os.date("now: date is %x , time is %X.",now))
-- to convert  date string to time, need a bit complex format functions,eg http://lua-users.org/wiki/DateFormattingFunctions

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Sep 30, 2015 8:46 pm    Post subject: Reply with quote

Because, like Panraven said :
"-- to convert date string to time, need a bit complex format functions,eg http://lua-users.org/wiki/DateFormattingFunctions"

It's need a makeTimeStamp(dateString) or makeDate(date). to manipulating string date to date format.
example can see in - link :
https://forums.coronalabs.com/topic/29019-convert-string-to-date/

Here is a CE Trainer, i made for use to check date variable with "stupid" way as shown in picture attach, completely with epoch UNIX series number as an answer for Stephen Yang, of course we can do with go to the link as presented by Dark Byte.

or in other way, we also can use :

Code:

test=os.time()
print(test)    ---- to get epoch UNIX number, note it
               ---- change computer OS date to get your own epoch


You also can modify or make your own trainer and adding complete date / time function to show such as : week of the year, hour, minutes, second, etc.

Just search date / time function in lua.

regards



Capture.JPG
 Description:
 Filesize:  25.67 KB
 Viewed:  8903 Time(s)

Capture.JPG



CRDR-Date Checker.CETRAINER
 Description:

Download
 Filename:  CRDR-Date Checker.CETRAINER
 Filesize:  1.4 KB
 Downloaded:  355 Time(s)

Back to top
View user's profile Send private message
Stephen Yang
Newbie cheater
Reputation: 0

Joined: 22 Feb 2015
Posts: 14

PostPosted: Mon Oct 05, 2015 1:54 am    Post subject: Reply with quote

Corroder wrote:

Here is a CE Trainer, i made for use to check date variable with "stupid" way as shown in picture attach, completely with epoch UNIX series number as an answer for Stephen Yang, of course we can do with go to the link as presented by Dark Byte.

or in other way, we also can use :

Code:

test=os.time()
print(test)    ---- to get epoch UNIX number, note it
               ---- change computer OS date to get your own epoch


You also can modify or make your own trainer and adding complete date / time function to show such as : week of the year, hour, minutes, second, etc.

Just search date / time function in lua.

regards


Thank you for your explain and the example CETrainer you made.

Would you please post the lua code you used in the Example CETrainer of post the Cheat Table?
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Mon Oct 05, 2015 3:36 am    Post subject: Reply with quote

Cetrainer is the same format as a CT, rename it or open it with a text editor. The different extension just tells CE what to do with it.
_________________
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Oct 05, 2015 6:24 am    Post subject: Reply with quote

This is version of CT file which allow to edit in CE or Notepad


CRDR-Date Checker-Ver.1.0.CT
 Description:

Download
 Filename:  CRDR-Date Checker-Ver.1.0.CT
 Filesize:  2.53 KB
 Downloaded:  722 Time(s)

Back to top
View user's profile Send private message
Stephen Yang
Newbie cheater
Reputation: 0

Joined: 22 Feb 2015
Posts: 14

PostPosted: Tue Oct 06, 2015 8:24 pm    Post subject: Reply with quote

Corroder wrote:
This is version of CT file which allow to edit in CE or Notepad

Thank you very much,I'm going to study it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites