Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

ABEL text adventure maker (sk,cz,en) 2023

An text adventure compiler in for android and windows. · By Bastian

5. objects in the world Sticky

A topic by Bastian created Jan 11, 2023 Views: 28 Replies: 4
Viewing posts 1 to 5
Developer

An object is a thing living or non living that exists in a room or inventory or somewhere you define it's place. Each object has an unique identifier. Because of this, you can then work with scripts that are defined on an object and for example use them on another object.

Developer

By opening the story.lua from the notepad++ IDE you can insert after the world definition a new room through the right panel.

If you cannot see the right side panel then press through the menu a symbol icon that looks like a puzzle piece.

Click the code at the end out of the world definition. Double tap the insert roomNew line.  And you will see the new room table added. First off, change the id to something like id="roomKitchen". This means that each room has a unique identifier assigned. Next type in some name="kitchen" and also a short description that will never change desc="You are in a small kitchen with some furniture and a door going out to balcony.".

There you go. This is your first room. In the world definition and the onStart function at the end you change the setRoom("roomStart") to setRoom("roomKitchen"). This will on each restart set your room to the kitchen as a beginning room. Save it ctrl+s. Then switch to the ABEL engine. And press F9 to restart the story. If no story is running then simply open or create one and then you should see the kitchen room being described.

Developer

Look again at the room table in code. There are some fields added.

place="outside",
- means that the room is placed outside so you can see the sky

place="inside",
- means that the room is placed inside  some building and you will not see the sky directly

background="background.jpg",
- put any image with jpg or png extension in the story folder and you can refer it here to have some nice game background for each screen

xy={0,0},
- remove it if you do not want to have the room on the map screen (accessed by TAB key)
- or type in some grid values of x,y coordinates to see the map layout based on exit directions, rooms visibility and rooms visitation

visible=false,
- by default each room is visible
- so if you want the room to be hidden and later changed to visible then type this
- to make the room visible simply use show("roomID") and it will be visible
- hidden rooms on map screen are shown as red in editor mode, but in game mode they will not be drawn until you enter them

exits={
 west="roomID1",
 up="roomID2",
},
- here you can connect room to other rooms in certain directions
- for directions refer as west, east, south, north, up, down, inside, outside
- use noway="You can't escape from here." to print this message if there is no available exit from a room

showItems=false,
- use this settings if you want to skip printing of items visible in a room

showExits=false,
- use this settings if you want to skip printing of exits visible from a room

lighting="dark",
- use this to set the room as dark and that means items will not be printed until you make the room lit again
- by default each room is considered as lighting="lit",

Developer

To describe the room more and with a text that can change because of the game state you will use the onDescribe function.

Inside the room table put the cursor in. Then pick from right side menu event world,room.onDescribe. The function will be inserted.  Put there some text("A special description added to the room."). Refresh the ABEL engine with F5 after saving the change in notepad++ and you should see the change on screen.

Developer

Now let's connect two rooms. First create another room called roomBalcony. And then connect both of them by exits so the roomKitches exit west="roomBalcony" and the roomBalcony exit east="roomKitchen" will then connect. Then test it and you should walk between this two rooms there and back.

This is full representation of the exits property of a room:
exits={
 east="",
 west="",
 north="",
 south="",
 inside="",
 outside="",
 up="",
 down="",
-- these directions will work only when you enable them in config.lua
northwest="",
northeast="",
 southeast="",
 southwest="",
-- this one will show only when there is no exit available in a room because of the surrouding rooms being not visible or not defined
noway="There is no exit from here for you to escape.",
},

Try to use a grid paper to draw the room layout first and then use it to describe and connect the rooms in the notepad++. This way you will make less errors.

Then do not forget to test the layout while pressing TAB key in ABEL engine.