Charting Your World

Wheter you are creating a sci-fi, a fantasy or any type of game really, most fundemental point in design is a world for your events to happen. In PyRYO Worlds this is done via a special module: charter

You first need to ‘import’ charter: import charter from there you can do anything.

Let’s start by creating a room

Creating a Room

Room creation is rather straightforward, a room is an instance of the clas Room and can be created as:

example_room = Room(room_id="room name", connections = [])

This creates a room with no connections, keep in mind that, connectinos= None is not a correct usage since None is not a list.

Adding or deleting a connection

In PyRYO, connections are rooms that are connected to another room. To add or remove a connection for instance:

#To connect example_room_2 to example_room:
example_room.edit_room(roomName="example_room_2", switch = "add")
#To remove this connection:
example_room.edit_room(roomName="example_room_2", switch = "del")

Keep in mind that roomName is the room_id of the desired room and not the variable name you’ve asigned to that room.

Get Connections

You can use example_room.get_connections() to get a list of rooms connected to example_room

Lock State

Each room comes with a variable named lockstate which defines if a room is locked (unaccessible) or unlocked (accessible), lockstate can be changed with:

# To unlock the door:
example_room.lockstate = "unlocked"
#To lock the door:
example_room.lockstate = "locked"

Keep in mind although both versions are equally right, using set_lock_state(lockstate) command with an invalid lockstate will send an error and won’t change it, wherehas asigning a lock state directly will change the lockstate regardless of the state asigned, which can be used to asign custom lockstates to a Room without changing the source code.