Adventure Game Studio | Forums

AGS Development => Editor Development => Topic started by: Crimson Wizard on Wed 18/01/2017 15:10:00

Title: Big list of missing script properties
Post by: Crimson Wizard on Wed 18/01/2017 15:10:00
MISSING SCRIPT PROPERTIES - these are properties that set or get something that is already implemented in the engine, but just does not have means to know its value or change it in script.

Please help gather a list of such properties, grouped by object type. In many cases that would be super-simple to add readonly properties (ones that can tell you certain value). Changeable properties are less easy, because they often require to add values to savegame, but they are also should be mentioned.

NOTE: this relates to only things that are already in AGS, not completely new features.
For example:
* you can set a property in the Editor, but cannot read or set it in script;
* there is a script function that changes object's state, but no way to get what current state is.

Such list will be very useful, because engine contributors get reminded about them only once in a while, and these requests got forgotten in the presence of more critical tasks.
I would like to make a table in the first post, which lists the required properties, and status of their implementation.

PropertyTypeCommentStatus
Button
Animatingbool, readonlyfrom Animate()3.4.1
Frameint, readonlyfrom Animate()3.4.1
Loopint, readonlyfrom Animate()3.4.1
Viewint, readonlyfrom Animate()3.4.1
Character
FollowedCharacterCharacter*readonlyfrom FollowCharacter()
GUI
BackgroundColorint3.5.0
BorderColorint3.5.0
Mouse (alternatively make new static CursorModes struct)
Animating[]bool, readonly
Frame[]bool, readonlycurrent animation frame (if any)
ModeAnimated[]bool, readonly?array property, get/set whether particular cursor is animated
ModeAnimatedOnlyOnHotspots[]bool, readonly?
ModeAnimatedOnlyWhenMoving[]bool, readonly?
ModeView[]intarray propertyget/set VIEW for the mode
ModeHotspotX[]intarray propertyget/set hotspot X for the mode
ModeHotspotY[]intarray propertyget/set hotspot Y for the mode
Title: Re: Big list of missing script properties
Post by: Vincent on Wed 18/01/2017 15:19:46
I'm very much happy to see the emergence of this topic.
To bless this newest thread I have a report to do just now.

Currently the buttons lack about these essential properties :

A) readonly bool Button.Animating
B) int Button.Frame
C) int Button.Loop
Title: Re: Big list of missing script properties
Post by: Vincent on Wed 18/01/2017 15:33:23
This is another report to do so far.
I suppose that if the object's property is available in the editor, it should be available in script too.

Actually, you can change the border color of a list box only inside the editor.
You can change the background color of a GUI only inside the editor.
Title: Re: Big list of missing script properties
Post by: cat on Wed 18/01/2017 19:57:35
The game version number. Would be useful to show on a title screen etc. so it's easy to figure out what version of the game a player has when analysing bugs.
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Wed 18/01/2017 20:02:16
Quote from: cat on Wed 18/01/2017 19:57:35
The game version number. Would be useful to show on a title screen etc. so it's easy to figure out what version of the game a player has when analysing bugs.
Hmm unfortunately it's not saved into the compiled game, but I guess it may be worth adding.
Title: Re: Big list of missing script properties
Post by: cat on Wed 18/01/2017 20:16:45
What is it used for now? I mean, I can edit it in the game's general settings.
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Wed 18/01/2017 21:03:26
Quote from: cat on Wed 18/01/2017 20:16:45
What is it used for now? I mean, I can edit it in the game's general settings.
It is used to create Windows Game Explorer data, which is embedded into game exe (Windows only).
Title: Re: Big list of missing script properties
Post by: Vincent on Thu 19/01/2017 10:56:00
I know that this is against the rule of this topic, however, I am going to say that the same...
It would be very nice if we could have buttons to be able to have their own transparency as well.
Most of the time I need to implement another gui with a single button to do that and play with ZOrder property anytime...

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Via script we can't get anymore those property so far from the editor.

readonly String Button.Name
readonly String Label.Name
readonly String ListBox.Name
readonly String TextBox.Name
readonly String Slider.Name
readonly String InventoryWindow.Name

bool TextBox.HideBorder


// And it would be very nice to have those property so far :)

int Button.Transparency
int Label.Transparency
int ListBox.Transparency
int TextBox.Transparency
int Slider.Transparency
int InventoryWindow.Transparency
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Thu 19/01/2017 11:05:23
Quote from: Vincent on Thu 19/01/2017 10:56:00
I know that this is against the rule of this topic, however, I am going to say that the same...
It would be very nice if we could have buttons to be able to have their own transparency as well.
Most of the time I need to implement another gui with a single button to do that and play with ZOrder property anytime...
Please, add feature requests to the Bug & Suggestion tracker, or they may get lost and forgotten (happens most of the time):
http://www.adventuregamestudio.co.uk/forums/index.php?project=3

Also, there are serious reasons why I asked to restrict this thread to the "missing" properties: firstly, there is a big difference between making them work in script, and creating completely new behavior. Secondly it is easier to work with the limited task.
From now on I will intentionally ignore anything that does not match the thread's topic.
Title: Re: Big list of missing script properties
Post by: Vincent on Thu 19/01/2017 11:11:44
Thank you very much Crimson Wizard, I have just add a new topic in the "Bug & Suggestion tracker" as well.

:EDIT: I am sorry if I break the rules, my mistake.

Quote from: Crimson Wizard on Thu 19/01/2017 11:05:23
From now on I will intentionally ignore anything that does not match the thread's topic.

You will do just the right thing.
Title: Re: Big list of missing script properties
Post by: Gurok on Fri 20/01/2017 09:47:14
Array.Length (pseudo-property)
Character.FollowedCharacter (you can set it with Character::FollowCharacter, but not get it)

Mouse:
GetModeView() to match ChangeModeView()
Animated, AnimatedOnlyOnHotspots and AnimatedOnlyWhileMoving boolean properties
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Thu 02/02/2017 21:00:15
What if we create new CursorModes (name in plural) static struct and move all Cursor mode setting properties there?

What I mean:
Code (ags) Select

struct CursorModes
{
  static attribute bool Animated[];
  static attribute bool AnimatedOnlyOnHotspots[];
  static attribute bool AnimatedOnlyWhenMoving[];
  static attribute bool Enabled[];
  static attribute int  View[];
  static attribute int  ModeHotspotX[];
  static attribute int  ModeHotspotY[];


Every property here will be array, with existing CursorMode enum used as an index, for example:
Code (ags) Select

CursorModes[eModeLookat].View = 10;


There is a possibly better variant to make an actual "CursorMode" object passed as a pointer, but that will be more complicated, requiring to create whole new managed object type. Also, logically next step is to replace CursorMode enumeration completely and declare game objects like cmModeTalkTo, or something like that. I am not ready to go that far at the moment.
With the static struct most of those properties could use existing code related Mouse struct.

Mouse struct may have functions such as ChangeModeGraphic stripped (deprecated, hidden under compatibility switch), and only have 1) items actually related to mouse control itself and 2) active mode specifics (Mode, SaveCursorUntilItLeaves, etc)
Title: Re: Big list of missing script properties
Post by: Radiant on Thu 02/02/2017 21:12:49
Actually the only one I'm missing on a regular basis is Character.StopAnimating (), or alternately being able to set Character.Animating to false.
Title: Re: Big list of missing script properties
Post by: Cassiebsg on Thu 02/02/2017 21:26:05
It's not possible to set frame delay to idle view via script (the settings for idle view only allow to set the delay of when the idle view should animate). So you need to manually change the delay off each frame in the editor.

This is assuming I didn't missed something, of course. :-[
Title: Re: Big list of missing script properties
Post by: Vincent on Fri 03/02/2017 20:41:08
@Crimson wizard@

I like the idea that you have got, although using arrays do not have a "quick easy" access to enumerations.
But it does not matter much because this idea would solve some issues actually.
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Fri 03/02/2017 21:35:23
Quote from: Vincent on Fri 03/02/2017 20:41:08
I like the idea that you have got, although using arrays do not have a "quick easy" access to enumerations.
What do you mean?
Title: Re: Big list of missing script properties
Post by: Vincent on Fri 03/02/2017 22:48:32
I just get a little confuse Crimson Wizard, I am sorry.
But your new method however would avoid to do such a thing..
Code (ags) Select

bool IsModeEnabled(this Mouse*, CursorMode mode)


In a more elegant way how you have just proposed.
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Sat 04/03/2017 20:48:18
We also need a counter-list of properties that are valid to be set in the Editor (as default values), but do not exist on property pane:

Object.Solid.
Hotspot, Region, Walkable area.Enabled ?
Title: Re: Big list of missing script properties
Post by: Vincent on Sun 05/03/2017 11:20:04
Quote from: Crimson Wizard on Sat 04/03/2017 20:48:18
We also need a counter-list of properties that are valid to be set in the Editor (as default values), but do not exist on property pane:

Object.Solid.
Hotspot, Region, Walkable area.Enabled ?

Crimson Wizard, I think this would be a fantastic idea to add indeed.
So you can set a certain Walkable area to be disable as its default property as well as for Hotspot and Region too.
I think that since Objects can make use of the property 'View' maybe there could be something similar as for the character pane as you can set the 'NormalView' property. But that would mean to add a default property for the 'View' also for the button pane. (Since it has only the 'Image' property)


@Off topic:
Last night I was trying to change via script the SelectedBackground color, SelectedText color and TextColor from a List Box and I could not do it. (Also to check in case if the "TextAlignment" was set to the 'Left' side so maybe you can place it further as well as on the 'Right' or 'Centre' side... Although this would mean creating a new behavior on the source code)
Later I think I could add this to the 'Bug & Suggestion tracker' in case...
 
Title: Re: Big list of missing script properties
Post by: Cassiebsg on Sat 13/05/2017 00:19:39
Uhm... I just realized there's no way to change the alignment of a GUI label via script, only via Editor.  :-\
Title: Re: Big list of missing script properties
Post by: Cassiebsg on Fri 26/05/2017 21:38:05
No way to change the settings of a Text Window GUI... like TextColor. This one seems to be missed often, as there are multiple threads on the forum asking about how to change it.
Title: Re: Big list of missing script properties
Post by: Dave Gilbert on Mon 29/05/2017 13:27:04
Just saw this thread. One property I've always wanted is the ability to do FRAME/LOOP FLIPPING! You can check IF a frame is flipped, but you can't actually SET the frame as flipped.

It would also be useful to flip an entire loop!

I'd also like a pony.
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Mon 29/05/2017 14:49:06
Quote from: Dave Gilbert on Mon 29/05/2017 13:27:04
Just saw this thread. One property I've always wanted is the ability to do FRAME/LOOP FLIPPING! You can check IF a frame is flipped, but you can't actually SET the frame as flipped.

It would also be useful to flip an entire loop!

You mean, during the game?
BTW, I think that's possible to do now by replacing frames with DynamicSprites, which you create from original and flip, then assign to the view frame.
Title: Re: Big list of missing script properties
Post by: Dave Gilbert on Tue 30/05/2017 15:57:57
True! But the advantage of being able to change the property via script is that you can use it to determine IF the frame is already flipped.

Currently you can use: "if (frame.Flipped == true)" to determine if the frame was flipped via the editor, but if you change the frame with a DynamicSprite you won't be able to do that. Ideally, I'd like to be able to do this:

if (frame.Flipped == false)
{
    frame.Flipped=true;
}

Meaning I can check if the frame is already flipped, and if not - flip it!
Title: Re: Big list of missing script properties
Post by: Radiant on Thu 28/09/2017 07:27:46
Oddly, the baseline of a walkbehind can be written to in script, but not read.
Title: Re: Big list of missing script properties
Post by: Monsieur OUXX on Fri 29/09/2017 13:09:18

PropertyTypeCommentStatus
File
f.NameString, readonlyThe name of the file
File.GetFolder(String path)static String, readonly"Renders" a path containing $APPDATADIR$ to its actual value (is there another way?)
AudioClip
ID or Nameint, readonly or String, readonlysome way to identify what AudioClip this is when iterating on AudioClips
AudioChannel
PreferredTypeAudioType, readonlyThe Audiotype it will play in priority, or some way to predict what will play what, in regards to the discussion here (http://www.adventuregamestudio.co.uk/forums/index.php?topic=54221.msg636549163#msg636549163)
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Fri 29/09/2017 13:28:51
@Monsieur OUXX, File.GetFolder may be a useful addition, but that's rather not a "missing property" in the sense this thread was created for.

Regarding AudioChannel.PreferredType - frankly I'd rather suggest redesigning of how channels work, because now it looks like you are trying to find a way to "hack the system".
Title: Re: Big list of missing script properties
Post by: Monsieur OUXX on Fri 29/09/2017 16:58:18
Quote from: Crimson Wizard on Fri 29/09/2017 13:28:51
frankly I'd rather suggest redesigning of how channels work, because now it looks like you are trying to find a way to "hack the system".

Well I was just trying to suggest a property that would be easily read straight out of the engine, with "not too much" additional work. I'm totally in favor of getting rid of those hidden priority rules indeed.
Indeed I misunderstood the thread -- apologies for posting.
Title: Re: Big list of missing script properties
Post by: Dave Gilbert on Tue 17/10/2017 03:13:08
The ability to get and set the inventory x & y hotspot via the script would be handy!
Title: Re: Big list of missing script properties
Post by: Gurok on Sat 12/05/2018 07:08:28
"UseRoomAreaLighting" is settable on an object in the editor, but there is no matching property at runtime.

"UseRoomAreaScaling" has Object.IgnoreScaling at runtime. Not ideal, but it might be an idea to make the new property match this convention.
Title: Re: Big list of missing script properties
Post by: morganw on Sat 12/05/2018 12:39:05
Quote from: Monsieur OUXX on Fri 29/09/2017 13:09:18

PropertyTypeCommentStatus
AudioClip
ID or Nameint, readonly or String, readonlysome way to identify what AudioClip this is when iterating on AudioClips

The missing name and non-visible ID does make it pretty difficult to randomly select an AudioClip. I thought that I could workaround this by checking the hex value that is used as the filename for the audio cache, but it seems this number doesn't match the ID value.
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Sat 12/05/2018 15:25:12
Quote from: morganw on Sat 12/05/2018 12:39:05
The missing name and non-visible ID does make it pretty difficult to randomly select an AudioClip. I thought that I could workaround this by checking the hex value that is used as the filename for the audio cache, but it seems this number doesn't match the ID value.

True, and as many other object IDs it cannot be set by user. Unreliable AudioClip.ID situation was discussed in another thread, regarding new audio system.

The only solution currently is to create custom arrays of AudioClip pointers in script, fill them in proper order and random pick from them.
Title: Re: Big list of missing script properties
Post by: morganw on Sat 12/05/2018 15:33:25
I wasn't sure what the overhead of creating the array was (I was looking to run this entirely in a script module, and so have no state to permanently store an array), so in the end I've defined case statements in a macro (all on one line), where each case returns an AudioClip. This seems to workaround it (when I import another AudioClip, I also add a case that returns it, and I just generate a random number to randomly get one).
Title: Re: Big list of missing script properties
Post by: Crimson Wizard on Sat 12/05/2018 15:36:39
Quote from: morganw on Sat 12/05/2018 15:33:25
I wasn't sure what the overhead of creating the array was (I was looking to run this entirely in a script module, and so have no state to permanently store an array)

Hmm... imho unless you have an array of many thousands entries, there should not be an overhead. Besides, you can create dynamic array.
But then, maybe I do not understand your case well enough.

Anyway, this does not deny the fact that script API is imperfect.
Title: Re: Big list of missing script properties
Post by: Snarky on Mon 21/05/2018 16:31:35
+AudioType crossfade setting
Title: Re: Big list of missing script properties
Post by: eri0o on Sun 10/03/2019 15:28:19
Object.Scaling
Title: Re: Big list of missing script properties
Post by: Slasher on Sun 10/03/2019 21:54:33
I would just like to say this:

Anything we can change in script that avoids us having to play through the whole game from the start is a big plus from me  (nod)
Title: Re: Big list of missing script properties
Post by: eri0o on Sat 10/08/2019 23:41:22
I noticed there is no way to invoke a ListBox.OnSelectionChanged event. Also it appears changing selection of a list box by code doesn't invoke ListBox.OnSelectionChanged.

I also noticed it's not possible to figure out if a Slider is vertical or horizontal. Apparently If Slider.Height < Slider.Width, it's horizontal. Sliders are also missing a way to check if sliderChanged
Title: Re: Big list of missing script properties
Post by: cat on Sun 11/08/2019 11:06:51
Quote from: eri0o on Sun 10/03/2019 15:28:19
Object.Scaling

This. Also setting manual scaling for objects would VERY useful.
Title: Re: Big list of missing script properties
Post by: Slasher on Sun 11/08/2019 12:22:03
Quote from: cat on Sun 11/08/2019 11:06:51
Quote from: eri0o on Sun 10/03/2019 15:28:19
Object.Scaling

This. Also setting manual scaling for objects would VERY useful.

Actually WYSIWYG would be positively fantabulosa  (laugh)