Colour Coding exits and objects.

Carrot
25 May 2009, 15:24
I know how to change the default colours (background / foreground), but what I want to do is to be able to make all objects appear in one colour, and all exits in another, and for both of these to be different form either BG of FG.

I had a look here, but it did't help :(

Overcat
26 May 2009, 11:39
Read up on text formatting codes, and then experiment with placing them in the example custom room description you had a look at.

Carrot
26 May 2009, 14:55
I have looked at that, but short of writing it in the room description, and turning off the automatic listing I am not sure what to do.

The above is fine if the objects are in their starting room, but if they are dropped in another room, I would like the auto listing of objects in that room to be coloured (if possible)

I tried sticking the formatting codes into the description of the item or its alias, but to no avail.

The only eason I thought this might be possible is because objects and exits are currrently listed in bold.

Or am I missing something very simple here?

Overcat
26 May 2009, 19:06
There are a few lines in the example custom room description that print the directions and objects:

if not ( #quest.doorways.out# = ) then msg <You can go out to #quest.doorways.out#.>
if not ( #quest.doorways.dirs# = ) then msg <You can go #quest.doorways.dirs#.>
if not ( #quest.doorways.places# = ) then msg <You can go to #quest.doorways.places#.>
if not ( #quest.objects# = ) then msg <You can see #quest.formatobjects#.>
if not ( #quest.lookdesc# = ) then msg <#quest.lookdesc#>


You can look up what all of the variables in those statements are, here. They're built-in string variables that you can use anywhere in your script. Try inserting color formatting codes around these variables:

if not ( #quest.doorways.out# = ) then msg <You can go out to |cr#quest.doorways.out#|cb.>
if not ( #quest.doorways.dirs# = ) then msg <You can go |cr#quest.doorways.dirs#|cb.>
if not ( #quest.doorways.places# = ) then msg <You can go to |cr#quest.doorways.places#|cb.>
if not ( #quest.objects# = ) then msg <You can see |cy#quest.formatobjects#|cb.>
if not ( #quest.lookdesc# = ) then msg <#quest.lookdesc#>


That will make all travel-able exits show in red, and all objects show in yellow.

Carrot
26 May 2009, 19:39
Thank you once again. That looks like what I am after.

Carrot
26 May 2009, 23:11
Been playing with that, and I am now a little confused.

This is my starting trmplate...
' "Game Name"
' Created with QDK Pro 4.1 Beta

define game <Game Name>
asl-version <410>
start <Start Room>
game author <Your Name>
game version <1.0>
game copyright <© 2008 ...>
game info <Created with QDK Pro 4.1 Beta>
default fontname <Courier New>
default fontsize <12>
background <black>
foreground <white>
end define

define options
debug on
panes off
abbreviations on
end define

define room <Start Room>
north <room 2>
end define

define room <room 2>
south <Start Room>

define object <object>
displaytype <Object>
article <it>
gender <it>
end define

end define


Which gives me

you are in start room
you can go north



When Iadd the colour coding into the mix:
' "Game Name"
' Created with QDK Pro 4.1 Beta

define game <Game Name>
asl-version <410>
start <Start Room>
game author <Your Name>
game version <1.0>
game copyright <© 2008 ...>
game info <Created with QDK Pro 4.1 Beta>
default fontname <Courier New>
default fontsize <12>
background <black>
foreground <white>
description {
if not ( #quest.doorways.out# = ) then msg <You can go out to |cr#quest.doorways.out#|cb.>
if not ( #quest.doorways.dirs# = ) then msg <You can go |cr#quest.doorways.dirs#|cb.>
if not ( #quest.doorways.places# = ) then msg <You can go to |cr#quest.doorways.places#|cb.>
if not ( #quest.objects# = ) then msg <You can see |cy#quest.formatobjects#|cb.>
if not ( #quest.lookdesc# = ) then msg <#quest.lookdesc#>
}
end define

define options
debug on
panes off
abbreviations on
end define

define room <Start Room>
north <room 2>
end define

define room <room 2>
south <Start Room>

define object <object>
displaytype <Object>
article <it>
gender <it>
end define

end define

I loose the "you can go..." line altogether. But the objects show up fine.

(Using 4.1ß - (build 4.1.210))

Overcat
27 May 2009, 11:31
Copy-paste the whole custom description script example into your game, then make the changes with the text formatting codes.

dragoncymru
12 Jun 2009, 16:59
I also want to put the odd object in a diffeent colour - but where is the 'pipe' key on the keyboard!!

(Sorry if I sound thick!)

Elexxorine
15 Jun 2009, 23:36
The 'pipe' key is usually just to the right of the left-hand shift, otherwise it may be near the space bar or any other crazy place depending on what keyboard you have. If you can locate the backslash, it's shift+backslash. It amy be missing if you have laptop or a weird keyboard, but you can bind another key to its function.

paul_one
17 Jun 2009, 00:48
On an uh-merican keyboard I believe the pipe is left of the number "1" on a 'standard' qwerty layout..
Their backslash is usually a shift+# if I remember right, although I don't have first-hand experience.

Instead of one solid line, it actually looks like a dashed line ( eg: "- -" but going up and down instead of side to side).

No comments on the formatting yet (I don't think I've tried installing V4 yet)

dragoncymru
17 Jun 2009, 05:34
Yup, got that now, although where exactly do you put that text formatting code to make an object appear blue in the object panel?

Carrot
21 Jun 2009, 10:28
dragoncymru wrote:Yup, got that now, although where exactly do you put that text formatting code to make an object appear blue in the object panel?


Open the .asl in a text editor and place in the section marked "define game" - see below. Once you have done this and re-loaded the asl into QDK, click the game section and go through all the tabs and you should see where it is put in, and therefore how to do it through QDK in the future, rather than cheating (like I did ;))

' "Test Game"
' Created with QDK Pro 4.1 Beta

define game <Test Game>
asl-version <410>
start <StartRoom>
game info <Created with QDK Pro 4.1 Beta>
background <black>
foreground <white>
description {
set string <roomtitle; |b|cl#quest.formatroom#|xb|cb>

if property <#quest.currentroom#; indescription> then {
set string <indescription; #(quest.currentroom):indescription#>
if ( $right(#indescription#;1)$ = : ) then {
set numeric <len; $lengthof(#indescription#)$ - 1>
msg <$left(#indescription#;%len%)$ #roomtitle#.>
} else msg <#indescription#>
} else {
msg <You are in #roomtitle#.>
}

if not ( #quest.doorways.out# = ) then msg <You can go out to |cr#quest.doorways.out#.|cb>
if not ( #quest.doorways.dirs# = ) then msg <You can go |cr#quest.doorways.dirs#.|cb>
if not ( #quest.doorways.places# = ) then msg <You can go to |cr#quest.doorways.places#.|cb>
if not ( #quest.objects# = ) then msg <You can see |cy#quest.formatobjects#.|cb>
if not ( #quest.lookdesc# = ) then msg <#quest.lookdesc#>
}

end define

define options
debug on
panes off
abbreviations on
end define


Re: the pipe character - http://en.wikipedia.org/wiki/Vertical_bar

Also, regards position, On UK keyboards the "|" (vertical bar) is usually by on the same key as "\" and is accessed via [shift]+[\]. The position of the key varies, but is commonly by the left shift, and occasionally around the enter key (if the enter key is bar rather than inverted L shaped). It can also be obtained by pressing and holding [alt] and typing 0124 on the numeric keypad.

The "¦" broken bar is on the same key as "`" and "¬" ([shift]+[`]), and is obtained by the combination of [ctrl]+[alt]+[`] or [alt gr]+[`]. This key is usually located at the left hand end of the numeric row, above [Tab] and below [Esc]. It can also be obtained by pressing and holding [alt] and typing 0166 on the numeric keypad.

NB: the broken bar is not the pipe character, I have just included it for reference. However, depending on your keyboard layout (and software interpretation/character set) you may find pressing ¦ results in | and vice versa.

Overcat
21 Jun 2009, 12:26
The built-in string variables have changed somewhat, as recently mentioned by Alex here. So the room description should be updated to reflect this. (#quest.doorways# replaces #quest.doorways.places#, #quest.doorways.dirs#, and #quest.doorways.out#.)