Jump to content

Starting at a specific time


Tequila

Recommended Posts

Has anyone done any develop around having a cartridge start at a specific time? By that I mean, the player can start the cartridge whenever they want but nothing will happen until 12 noon for example.

 

I want to create a cartridge around a solar eclipse and want the player to complete a series of tasks during the time the eclipse is happening. In order to do that, I need to be able to control the start time.

 

Thoughts?

Link to comment

You can get the date using date()

 

e.g.

message = os.date()

Wherigo.MessageBox{Text=[[Date is :]]..message,Media=zmediaPicture,Buttons={"OK",},}

 

or

 

theCurrentTime = os.date('!*t')

if theCurrentTime.year == 2009 then

Wherigo.MessageBox{Text=[[its 2009]],Buttons={"OK",},}

else

Wherigo.MessageBox{Text=[[its not 2009]],Buttons={"OK",},}

end

 

The fields of interest are

hour

min

wday

year

yday

month

sec

day

isdst

 

All variables are numbers, apart from isdst which is true or false (is daylight saving time)

 

The !*t I think gets you universal time/GMT/+0hours, so people can't cheat by changing the timezone :P

Edited by a_snail
Link to comment

You can probably use the lua time functions.

 

Pseudocode:

nowTime = os.date()
if nowTime > eclipseStartTime && nowTime < eclipseEndTime then
CartridgeStart()
else
MessageBox{"Sorry, Charlie."}
end

 

Alternatively, and perhaps a better idea, is to check the date against the eclipse's start and end times, starting like the above pseudocode. Instead of just telling the person to restart the cartridge during the eclipse, create a countdown timer with duration being the number of seconds until the eclipse's start time (also including code to make sure there isn't an error if the person starts the cartridge after the eclipse). You can then show a message box to the player, stating the cartridge will start at this-and-this time. The player can then wait around until the timer expires and the cartridge will begin automatically. I think that's a more elegant solution than the "Sorry, Charlie" way.

Link to comment

You could always test for the desktop emulator, make a secret zone in the field, add a password to skip it, or something if you want it to be in the field and test the cartridge both with and without the time code.

 

Alternatively, you could make a true/false (Boolean) variable and use that in your if statements: "if doTimeTest then, [time code], end". In this way, you can control from one location, the Boolean's value, whether your cartridge uses your time tests.

 

When I'm in the field testing my cartridges, I tend to create either alternate versions of the cartridge or a menu item that will skip me to various points in the cartridge. My decision depends on what I'm testing.

Link to comment

Thanks. Those are great ideas.

 

A friend also includes "easter eggs" in his code. He always has a " secret sequence of event" the player can easily do if they need to get a cartridge marked "complete.

 

In the past I've used a configuration tablet which has all sort of customisations on it, and then I just mark as invisible if I don't want people to use it.

 

That said, I've stopped putting in preventions, as long as people enjoy the Wherigo that is sufficient for me, if they want to dry run it in the emulator first before taking the kids out, I'm not too bothered (apart from the initial first to find). My aim these days is to make it fun and something people want to play, and for the game to be slightly random, so even if they have pre-played, its still a challange when they play for real. Also I have no objection to people who have no chance of ever getting to the UK playing in the emulator and getting ideas for their own games. Anyway, enough of that for now, probably should be in a different thread.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...