Ego-based directions instead of compass

chum
29 Jul 2011, 03:10
Hi all,
I was wondering if there was any way to implement ego-based directions i.e. left, right, forward, back, instead of compass directions. I appreciate any help.

Pertex
29 Jul 2011, 07:09
I think it can be done in Q5, but you have to change some core-libraries (CoreDescriptions.aslx). "Left" means something like "turn left" and then a description like "In front of you you can see a bed and a picture." is displayed? Turning left again will display an other description like "In front of you you can see a table. There is a door (exit)."
You would have to disable the right panes and add an new attribute to all objects to define its position in the room. Player must have an attribute where his direction is stored. New commands "left", "right", "forward" and "back" and some more scripts and it should work

Pertex
29 Jul 2011, 09:58
Ok, I just tried to do it. Here is a prototype of something like this.
In my opinion ego-based directions are not the best for textadventures.

chum
29 Jul 2011, 15:45
Thank you for the demo.
I can see what you mean from playing it. For one it's more difficult to navigate. If I wasn't concerned with moving around inside a room, I don't think I would need to add a location attribute for each object, but would I need to change the core libraries?

I notice that the directional pad is still compass-oriented. What would it take to change the compass direction tool so that the north button is forward, right is east, and so on?

Alex
29 Jul 2011, 15:54
You would need to override the compass templates - English.aslx defines CompassNW, CompassN, CompassNE etc. You could set CompassW to "Left" and CompassE to "Right".

chum
29 Jul 2011, 17:35
Pertex: I appreciate the time and effort you put into the demo, but I am struggling to understand and implement what you did. I looked over what I could find in the debugger and I found the commands turnleft etc. in the commands menu but I don't understand the structure of things. I can't f_turn anywhere besides in the commands' attributes.

What I have done so far looks like this:
Command:
forward
name: forward
Script:
if [object attribute equals] object [object] [player] Attribute [orientation]= north
then call function [north]

What I'm trying to do is make an attribute for the player that contains a string with the direction the player is facing at the beginning of the game i.e. north, and make commands such as 'forward' that respond accordingly i.e. execute the same code as the command 'north' for the command 'forward' in this case because the player is facing north.

I have probably got the objects, expressions and attributes mixed up though; I saved this and now I can't load my game even to edit it because of that. I get an error message that reads, "Failed to load game due to the following errors: *Error adding script 'if(player.orientation = north) {north}':Function not found: 'north'

Alex: Thank you too. I'll definitely try and use that.

Alex
29 Jul 2011, 17:52
You should be able to edit your game in Beta 4 - the Editor no longer fails when you have a missing function (the Player will still fail though). If it's still failing with the latest version please let me know and I'll look into it.

chum
29 Jul 2011, 18:09
Yeah it works now.

Pertex
29 Jul 2011, 20:18
chum wrote:
if [object attribute equals] object [object] [player] Attribute [orientation]= north
then call function [north]


There is no internal function 'north' so you have to write such a function. Within the function you must check, if there is an exit in this room to north and then move the player to the room where the exit leads to. You can see this in ego.aslx in the function f_turn (Else If: expression dir="forward")


For each:loop exit in source expression ScopeExits()
If: expression exit.alias="north"
Set variable: player.parent=expression exit.to