change font of container children

Avantar
28 Nov 2013, 18:20
I hope someone is able to help me....

Changing the font colour of text is one thing, but how would one change the font colour of a container's children once you have opened it. Displaying the children in the status bar in black makes it difficult to distinguish between items that can be seen and items actually in the container.

Thank you in advance!

Pertex
28 Nov 2013, 20:31
Do you mean the "Places and Objects" pane?
I think this can only be done by changing the Quest engine or some wired scripting with jquery

Avantar
29 Nov 2013, 03:21
Yes, I mean the places and objects pane.

That is a pitty. Even if I could just have changed the children to bold.
Let's say it is not possible for a container like a chest that lists its contents under Objects and Places pane, but what if it is a container you have in your inventory, like a backpack. Would you be able to change the font colour of its children or does the same apply?

Thank you for the reply.

The Pixie
29 Nov 2013, 08:04
How about prefixing a hyphen os something? Change the listalias attribute depending on whether the object is in a container.

Avantar
29 Nov 2013, 16:20
Thanx Pixie!

That sounds like a brilliant plan. I will check out the listalias thingy and report back.
:D

Avantar
30 Nov 2013, 07:52
So I had a look at listalias attribute...

Just changing this attribute to display a hyphen in front of the object name, looks good enough for me.
The problem now is that I only want it to display the hyphen in front of the name when it is in the container. When I take the object from the container and it goes into my Inventory, the hyphen should not display.

So i have started with the most basic script:

item_x = GetDirectChildren(this)
msg (item_x)


This does display all the objects like so: Object: Sword, Object: Axe...
So now I want to change these objects listalias attribute to "-" + object.alias.
Even before I tried any For loop or check for the item in the container, I did the following to check:

item_x = GetDirectChildren(this)
msg (item_x.alias)


Now there is an error saying that item_x does not refer to an object. So I have tried a For loop and used GetObject, but it complains that I can not use a For loop; since it is not a list. GetObject does not work in any way I have tried it either.
Now I am a bit lost/dumb and pretty please ask for a bit of advice.

Thank you kindly.

Avantar
30 Nov 2013, 08:29
Ok...I've been thinking: Since I do not have a list for the FOR loop, why not create one.

This is what I have so far - just as an update and to confirm that this is the right way of doing it:

myList = GetDirectChildren (this)
for (myItem, 0, ListCount(myList) - 1) {
object_x = ObjectListItem(myList,myItem)
msg (object_x.name)
}


Some Items do not have an alias and gives me an error if I use object_x.alias and hence I have used (for now) object_x.name at the end.

I will try to add the hyphen, check for the container being the parent of the object and removing the hyphen once taken.
Will let you know how it goes.

Liam315
30 Nov 2013, 08:33
GetDirectChildren() returns an object list, not an object, so trying to reference the attribute .alias causes an error. Once you insert the foreach part into the script it should be fine.

foreach (obj,GetDirectChildren(item_x)) {
msg ("- " + obj.alias)
}

Avantar
30 Nov 2013, 08:39
Well - this concludes it for me:

myList = GetDirectChildren (this)
for (myItem, 0, ListCount(myList) - 1) {
object_x = ObjectListItem(myList,myItem)
object_x.listalias = "--" + object_x.name
}


and on the 'take' attribute of the object:

this.listalias = this.name


I have to put the first code on all containers as a script after opening the container and the second code snippet on every object on its 'take' attribute.

Is there a more global way of doing this?

Avantar
30 Nov 2013, 08:42
Sorry Liam - I didn't see you reply...lol

I will try that, thank you. It will streamline the code a bit. :D