Can I change the displayed order of status attributes?
Arvetis
13 Jun 2023, 17:47Apologies if I missed this in the documentation, but I couldn't seem to find it. I don't like the order in which my player's status attributes are being displayed, and I can't figure out how to change that. I tried removing the status attributes and then re-adding them to get the ones I wanted at the bottom, but they simply returned to the same order they were in previously.
mrangel
13 Jun 2023, 18:01They should appear in the order they are in the dictionary. It sounds like the editor isn't saving them for some reason.
Which statusattributes list are you using?
It might be worth removing them, saving, and then adding them again in the order you want.
If all else fails, you could try to rearrange them using a script that runs at the start of the game.
For example:
dictionary remove (game.povstatusattributes, "health")
dictionary add (game.povstatusattributes, "health", "Health: !")
should remove an item from the list and add it again, forcing it to be at the end.
Arvetis
13 Jun 2023, 18:06I tried removing and re-adding them in the "status attributes" section of the GUI. When that didn't work, I tried manually editing the statusattributes dictionary attribute itself, but that one also reset after launching the game. It seems like it's remembering their original add order somewhere, but I can't figure out where.
Ip Man
13 Jun 2023, 22:51I don't know if you're as green as I am, but I had this problem a few weeks ago.
I kept modifying the attributes list on the Player Object, wondering why that didn't change how they showed up in the Status pane.
Then I reread Pixie's instructions for making a custom status pane in CombatLib, and realised that there's not only a dictionary of the Player's status attributes... but the Pane is controlled by a dictionary of the attributes on the Game object!
That's where it pulls the order from. Once I found that it was just a little quick Copy pasting in Code view, and everything is now in order.
I don't know whether to that this helps because you're as slow at this as I am, or to hope that you have a different problem!
Arvetis
14 Jun 2023, 01:47That could well be it, but I can't seem to find that attribute. Do you remember what it's called?
Ip Man
14 Jun 2023, 02:49in mine it's statnames and it's a string dictionary
Ip Man
14 Jun 2023, 03:05I'm so sorry! I was wrong. That one on the Game object is not the one that determines order in the status pane. That just defines the attributes.
The one that defines the order is called "statusattributes" on the player object. It's also the top pane on the player object where you have a GUI to add them one by one.
mrangel
14 Jun 2023, 08:45There are three places status attributes can be defined:
game.statusattributes
, which is on the attributes tab of the game objectgame.povstatusattributes
, which is on the player tab of the game objectgame.pov.statusattributes
, which is on the attributes tab of the player object.
Those three stringdictionaries are stuck together (in that order) to make the final list of which attributes are displayed.
There are some libraries which can then sort the list; but without such a library, the objects will be displayed in the order they appear within each list.
mrangel
14 Jun 2023, 09:45Oh… one case where there might be an issue is the built-in health, status, and money systems. If enabled, those status attribute are automatically added to the end of game.statusattributes
(score) or game.povstatusattributes
(health and money) by the InitStatusAttributes
function, which is called from StartGame
.
If you want those particular status attributes to be shown in a different order, you will need to disable those "features" and add the status attributes manually. The downside of that is that disabling those features also hides some stuff in the editor. So if you use the GUI to create scripts, you may need to go to the UI Initialisation Script (On the game's Advanced Scripts tab), and add something like:
game.showhealth = false
game.showscore = false
game.showmoney = false
This will disable them before InitStatusAttributes
runs; meaning that they will stay where you put them.
Ip Man
14 Jun 2023, 22:44Thank you again for sharing these important bits with us Mr. Angel! I'm sticking that in my OneNotes along with so much of your other knowledge and wisdom!
I do remember at some point I had to find out how to hide "health" because Pixie's CombatLib uses "Hitpoints" so I then also went to add those to the status pane.
Along with those opposite attributes you helped me figure out the statchg function for. SO my status pane is full... but I'd forgotten all the little particulars and didn't know them in this much detail for how I'd changed it. It's good to know about the 3 lists and the ordering!