How to change object description?
I can change sprites from object but not the description.
If you mean, Object.Name, this may only be changed at runtime since AGS 3.6.0.
In earlier versions the solution may be to use custom properties instead.
https://adventuregamestudio.github.io/ags-manual/CustomProperties.html
I tried it and I got an error. Object.Name is read only.
I'd like to change description of the object.
Edit: I made mistake here. Please delete it.
I'd like to change description of the object.
(https://pbs.twimg.com/media/FqU_Ba8XgAQSfBd?format=png&name=360x360)
Quote from: Volcan on Fri 03/03/2023 22:09:15I tried it and I got an error. Object.Name is read only.
Which version of AGS exactly are you using? Object.Name is only available for change in 3.6.0.
In earlier versions you would need to use something else, like custom properties, or make your own variables in script to store object descriptions.
3.5.1
I guess I need to update my AGS Studio.
Edited: I noted in AGS main page, the last version is 3.5.1 patch 18.
Where can I find 3.6?
Quote from: Volcan on Fri 03/03/2023 23:02:483.5.1
I guess I need to update my AGS Studio.
You may, but you don't have to, if it's only this problem, there are solutions in 3.5.1 too which I mentioned, and maybe some others.
Quote from: Volcan on Fri 03/03/2023 23:02:48Edited: I noted in AGS main page, the last version is 3.5.1 patch 18.
Where can I find 3.6?
3.6.0 is still not final, it's a wip version. It's under "Other downloads & resources" on the page.
Also in this forum thread:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-0-release-candidate-rc1/
I tried with this code.
object[0].Graphic = 84;
object[0].GetTextProperty("book-one");
object[0].SetTextProperty("book-one",text1);
But in the game, in the statusbar at the bottom of the screen still writes Book despites we see there's a coin on the counter not a book.
(https://pbs.twimg.com/media/FqWCX2jX0AEMiPP?format=png&name=small)
Quote from: Volcan on Sat 04/03/2023 03:11:41But in the game, in the statusbar at the bottom of the screen still writes Book despites we see there's a coin on the counter not a book.
Well, of course, because it does not know that it should be using your custom property. You also need to change how the status bar displays the object names.
I don't know how do you that in your game, have you scripted the status bar yourself, or you are using some built-in behavior?
If custom property is supposed to be optional (not set for all the objects), then you could do this:
* check if custom property's text value is not empty;
* if it's empty, then use the object's Name;
* if it's not empty, then use the property's text.
Calling the text property "book-one" doesn't make much sense, it should be something like "label" or "dynamic name".
Anyway, assuming that you're using the default "@OVERHOTSPOT@" as the label text, you need to set it manually in repeatedly_execute:
int lt = GetLocationType(mouse.x, mouse.y);
String labelText = Game.GetLocationName(mouse.x, mouse.y), dynName;
if (lt == eLocationHotspot) {
Hotspot *h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
dynName = h.GetTextProperty("label");
}
if (lt == eLocationObject) {
Object *o = Object.GetAtScreenXY(mouse.x, mouse.y);
dynName = o.GetTextProperty("label");
}
if (lt == eLocationCharacter) {
Character *c = Character.GetAtScreenXY(mouse.x, mouse.y);
dynName = c.GetTextProperty("label");
}
if (dynName.Length > 0) labelText = dynName;
lblStatusBar.Text = labelText;
Also, line 2 from your snippet is completely pointless.
As a sidenote, an easier workaround might be to use two objects. To me it seems that you change the book object's graphic to a coin (as part of a transaction). Instead you could just disable the book object and enable a coin object.
Also I advice you to use object names instead of their numbers, e.g. oBook.Graphic instead of object[0].Graphic. This makes your code more readable and mistakes less likely.