Page 31 of 31

Re: A text Myst Online project

PostPosted: Wed Sep 25, 2013 6:09 am
by Acorn
KathAveara wrote:If all goes to plan, which /eval suggests it will, head down anytime in the nest 25 hours. Better sooner than later.


Drat, visited twice but missed the eclipse* :oops: - and missed your reply, because the forum logged me off without my realising, and I didn't spot there were unread messages :evil: I hate it what that happens!

Do remind us when the next one is due!

*edited to make clear what I was on about!

Re: A text Myst Online project

PostPosted: Wed Sep 25, 2013 8:03 am
by belford
Rather, you need the waking timer to behave as though the timer had been running while asleep.


This is the right trick.

(Also correct that datetime.now is not a database property.)

Look at the http://seltani.shoutwiki.com/wiki/Fuel_Runs_Down code sample to see how I handled Goldspring. There's a timer that runs every ten minutes while the instance is awake. It also runs at on_wake time, and immediately computes the correct current value, so that the newly-arrived player sees the right state.

(Since the fuel generator in Goldspring drops one notch every 30 minutes, a check every ten minutes is plenty sufficient.)

I realize this sleep/wake architecture is a nuisance, but it ensures that the server load stays low.

I'll try to write up a simpler code sample for a day-night cycle. The Fuel_Runs_Down is slightly more complicated than that, because the start point of its "day" is the moment somebody presses the "fill" button.

Re: A text Myst Online project

PostPosted: Wed Sep 25, 2013 9:16 am
by KathAveara
That was a typo. I meant to say that it is *in* a property.

Re: A text Myst Online project

PostPosted: Fri Sep 27, 2013 12:42 pm
by KathAveara
How does one actually use players.player(player)?

Re: A text Myst Online project

PostPosted: Fri Sep 27, 2013 10:10 pm
by belford
You might say, in one bit of code,

Code: Select all
prop = ObjectId(player)


And then in another:

Code: Select all
_player = players.player(prop)


_player would then refer to the player object you started with.

Re: A text Myst Online project

PostPosted: Sat Sep 28, 2013 2:03 am
by KathAveara
Is there a way to use it if you don't know the player's ObjectID?

Re: A text Myst Online project

PostPosted: Sat Sep 28, 2013 8:48 am
by belford
No. All references to a player must originate from code (the player global, players.list(), etc) or from word-of-mouth (you type /playstate and copy down your objectid).

I don't want a way to look up players by email (email addresses should be private) or by name (I think eventually there will be a way to change your avatar name, so hard-coding references to names is a mistake).

Re: A text Myst Online project

PostPosted: Tue Oct 08, 2013 6:43 pm
by Pavitra
(The ending has not yet been written. This thread continues here.)