[REBOL] Re: An array of objects?
From: mike:yaunish:home at: 21-Dec-2000 18:16
At 04:55 PM 21/12/00 -0800, you wrote:
You may want to make the rooms into blocks instead - of course there are a
hundred ways
to skin this cat - but here's what I know.
room1: [
directions [0 1 0 1] ; N S E W
description "You are in a dark cave!"
]
room2: [
directions [1 0 0 1]
description "You are outside!"
]
rooms: []
append/only rooms room1
append/only rooms room2
>> rooms/1
== [
directions [0 1 0 1]
description "You are in a dark cave!"
]
>> rooms/2/description
== "You are outside!"
Good luck, if you go this way it will bring up all the fun ways to create
paths.
>For a text-based game (a MUD, essentially), I'm trying to create a system
>by which the players can travel from room to room within the world, via.
>an array of rooms (i.e. Room(1,1), Room(200,2) etc.). I thought this would
>be an easy task but I have had trouble. How do you create arrays of
>objects in Rebol?
>
>I originally tried creating a block of objects, so I could access them
>like world/1/description, but it errors (and it isn't in an array, which
>would makes things harder down the road)
>
>---
>
>world: make block! [
>
> room1: make object! [
>
> directions: [0 1 0 1] ; N S E W
> description: "You are in a dark cave!"
>
> ]
>
> room2: make object! [
>
> directions: [1 0 0 1]
> description: "You are outside!"
>
> ]
>
>]
>
>_____________________________________________________________
>Get free email ==> and Free Fun http://www.BlueJellybean.com
>--
>To unsubscribe from this list, please send an email to
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
Mike Yaunish
[mike--yaunish--home--com]