Page 22 of 31

Re: A text Myst Online project

Posted: Mon Aug 12, 2013 4:21 pm
by Pavitra
Huzzah! Thank you Belford!

Re: A text Myst Online project

Posted: Tue Aug 13, 2013 8:07 pm
by KathAveara
I'll be back in England in 17 hours or so. Then I can build my AIs!

Re: A text Myst Online project

Posted: Thu Aug 15, 2013 12:39 am
by Pavitra
What's the reasoning behind players.player(foo) and players.name(foo)? The distinction seems subtle and confusing, and I don't see the value of having the distinction.

Re: A text Myst Online project

Posted: Thu Aug 15, 2013 12:54 pm
by Pavitra
You can now add linking books to the shelves in your personal Tsani-Tsina instance.

Re: A text Myst Online project

Posted: Thu Aug 15, 2013 3:13 pm
by belford
What's the reasoning behind players.player(foo) and players.name(foo)?
The first is a player object, and the second is a string. They're not interchangeable. Use a player object to get a player properties, and to pass to other players.xxx() functions. The player name is only for printing.

Re: A text Myst Online project

Posted: Thu Aug 15, 2013 3:21 pm
by belford
You can now set the focus to a code property, although it's not automatic. It would look like:

Code: Select all

setfocus("sign")
...where sign is a code property that calls print() to generate output.

The behavior of print() is not yet as general as I'd like, but it works for this case.

Other changes today:

The unfocus() function is documented.

Invoking a code property can be done either with or without parentheses. That is, the following are equivalent:

Code: Select all

dosomething
dosomething()
(You cannot yet pass arguments to a code property, but I'll get there.)

http://seltani.net/doc/ now refers to the wiki. The wiki is the primary documentation at this point.

I've added a section on books and bookshelves to the wiki. (http://seltani.shoutwiki.com/wiki/Writi ... _bookshelf)

In the build interface, when you enter a text or code property, the syntax is validated before it's saved.

In the build interface, the "create portal to this location" now creates a global link rather than a personal link. (Unless the world is marked solo, of course.)

Re: A text Myst Online project

Posted: Thu Aug 15, 2013 5:36 pm
by Pavitra
belford wrote:
What's the reasoning behind players.player(foo) and players.name(foo)?
The first is a player object, and the second is a string. They're not interchangeable. Use a player object to get a player properties, and to pass to other players.xxx() functions. The player name is only for printing.
the wiki wrote:players.player()
players.player(player)
Returns the name of the acting player, or the player with the given database key (an ObjectId). If the argument is a player object, this returns it unchanged.
Should this read "Returns the player object of the acting player[...]"?

Re: A text Myst Online project

Posted: Thu Aug 15, 2013 6:55 pm
by belford
Yes, right. Thanks.

Could you set me to have main-page editing access on the wiki?

Re: A text Myst Online project

Posted: Fri Aug 16, 2013 2:08 am
by Pavitra
Done, I think. I don't know of a way for me to test whether I did it correctly.

Re: A text Myst Online project

Posted: Fri Aug 16, 2013 9:43 am
by KathAveara
Hey, Belford, could we have for loops enabled, please? I have some code (below) as part of my snake AI that could really do with a for loop.

The current code is:

Code: Select all

if snakepos == 1:
  if foodpos % 2 < 1:
    foodpos -= 1
    snakehunger += 3
elif snakepos == 2:
  if foodpos % 4 < 2:
    foodpos -= 2
    snakehunger += 3
elif snakepos == 3:
  if foodpos % 8 < 4:
    foodpos -= 4
    snakehunger += 3
elif snakepos == 4:
  if foodpos < 8:
    foodpos -= 8
    snakehunger += 3
and with a for loop, I could reduce it to one-quarter the size.