Signup Now
Results 1 to 4 of 4

Thread: date comparing

  1. #1
    Free User
    Join Date
    Feb 2016
    Location
    Poland
    Posts
    56
    Reputation
    10
    Rep Power
    17

    date comparing

    how to compere dates ? I try to write a function which will logout character if his time playing is higher than X. I thought that would by quite easy example
    if ($charactertime > 3*60*60*100) then go xxx and logout. Unfortunatelythe result of this request $charactertime is in some strange format (in the documentation I read that it should by in ms) but the result of this request looks like this... 22:05:40:46. I tried before to round it time(math.floor($charactertime / 1000)) - and it returned more accessible result - 33:20 (mm:ss) but I'm not sure how can I compare this :/
    Sorry if my English is incomprehensible. Please correct me, I will know for the future. Five years without any training of language... idioms, phrases, grammar sometimes (jeeeeaa... frequently) makes me problem

  2. #2
    Free User
    Join Date
    Feb 2016
    Location
    Poland
    Posts
    56
    Reputation
    10
    Rep Power
    17
    any sugesstions ?
    Sorry if my English is incomprehensible. Please correct me, I will know for the future. Five years without any training of language... idioms, phrases, grammar sometimes (jeeeeaa... frequently) makes me problem

  3. #3
    Free User Cisco's Avatar
    Join Date
    Aug 2014
    Location
    Brazil
    Posts
    1,424
    Reputation
    119
    Rep Power
    23
    Quote Originally Posted by Vexus View Post
    how to compere dates ? I try to write a function which will logout character if his time playing is higher than X. I thought that would by quite easy example
    if ($charactertime > 3*60*60*100) then go xxx and logout. Unfortunatelythe result of this request $charactertime is in some strange format (in the documentation I read that it should by in ms) but the result of this request looks like this... 22:05:40:46. I tried before to round it time(math.floor($charactertime / 1000)) - and it returned more accessible result - 33:20 (mm:ss) but I'm not sure how can I compare this :/
    1- $stamina = time stamina...example:

    by default $ stamina is in minutes. Q If you want him to leave with $ stamina less than or equal to 15h ....

    if $stamina <= 15*60 then  -- number 15, It means hours
    gotolabel('Start', 'Refill')
    end


    not putting as hours ...

    if $stamina <= 900 then  -- number 900, stamina default minutes
    gotolabel('Start', 'Refill')
    end


    2- $charactertime = played time HUD...time default milliseconds....example:

    if $charactertime >= 1*3600000 then ---
    gotolabel('Start', 'Refill')
    end


    1 = h
    3600000 = 1h in milliseconds...
    When the character is 1 hour or more in the game, time "counted on the clock" it will exit

    ---Resume

    $stamina = default minutes....
    1h = 60 minutes therefore = 1x60 = 1*60
    2h = 120 minutes therefore = 2x60 = 2*60
    and so on


    $charactertime = default milliseconds....
    1h = 3600000 therefore = 1x3600000 = 1*3600000
    2h = 7200000 therefore = 2x3600000 = 2*3600000
    and so on


    I hope you understand. Sorry for English.

  4. #4
    Free User
    Join Date
    Feb 2016
    Location
    Poland
    Posts
    56
    Reputation
    10
    Rep Power
    17
    I tried to do something like this but apparently I had something to screw up. Thanks, now it is working.
    Sorry if my English is incomprehensible. Please correct me, I will know for the future. Five years without any training of language... idioms, phrases, grammar sometimes (jeeeeaa... frequently) makes me problem

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •