[E] Missing Runtime Expression Checkboxes

Post about what you like and dislike on AAO and suggest new features and improvements.

Moderator: EN - Forum Moderators

Post Reply
User avatar
TimeAxis
Posts: 389
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English
Contact:

[E] Missing Runtime Expression Checkboxes

Post by TimeAxis »

Image

Currently, in the "Reveal an object in a place" and "Hide an object in a place" actions, there is no "Load from runtime expression" checkbox on certain important fields in Advanced mode. The "place_id", "layer", and "id" fields only accept raw input. I don't know if these checkboxes are absent for a reason, or if somebody just forgot to put them there, but either way, their absence unfortunately makes advanced mode essentially useless for these actions, as even though the "Place" field can be loaded from a string, the place_id cannot be made to match it. The "id" field is particularly important for revealing/hiding specific objects from expressions. (And a case I'm working on for the current contest hinges heavily on being able to do exactly that, leaving me at a bit of a loss at the moment. :( )

Of course, I checked if maybe these fields just didn't need a checkbox and accepted expression input either way, but this appeared to not be the case. I did not check this thoroughly enough. My bad. This was the case. They do accept expression input. Nevermind.
Spoiler : Rest of old post :
The chances of this feature being implemented before the current contest is over, amid everything else that's being worked on right now, are probably slim to none (and it would be pretty selfish of me to ask for that) But on the off-chance that these fields are not absent for any particularly significant reason and are only missing as an oversight, I attempted to look through the code to see if I could find what I would need to edit if I wanted to add this functionality myself. There was a lot to sift through, though, and I got a bit overwhelmed. If possible, any pointers that might narrow down which files to look through if I were to implement it myself would be greatly appreciated.

Thank you

P.S. If it's at all helpful, here are the results of some experiments I did on my own build.
Spoiler : :
For this section on line 210 of action_descriptions.php:

Code: Select all

//Edit game environment
		$action_parameters['EditEnvironment']['RevealObject'] = $action_parameters['EditEnvironment']['HideObject'] = array(
			'multiple' => array(
				'object' => array(
					'place_desc' => array(
						'type' => 'place_descriptor'
					),
					'object_desc' => array(
						'type' => 'object_descriptor',
						'type_param' => array(
							'place_descriptor' => array(
								'type' => 'var', 
								'var_name' => 'place_desc'
							)
						)
					)
				)
			)
		);
If I remove this part, starting on line 218:

Code: Select all

,
						'type_param' => array(
							'place_descriptor' => array(
								'type' => 'var', 
								'var_name' => 'place_desc'
							)
Then the checkboxes appear as expected, and work properly, accepting variables as input. The only problem is... This breaks the default non-advanced mode interface, making it so that when you select a Place, it doesn't let you select from a list of objects in that place, so it only works when the fields are manually filled out in advanced mode, which is obviously... not ideal. So what I gather seems to be that there's something about this 'type_param' that's making these parameters not display the checkbox for some reason. That's as far as I can figure out.
Last edited by TimeAxis on Sat Mar 26, 2022 12:33 pm, edited 1 time in total.
Image
Question Arcs (Threads Coming Eventually)
ImageImageImageImage
Gaiden Episodes
Champion of Turnabouts ★
HALLOWEEN HERO
Other
Phoenix Wright: Ace Attornauts
The Curious Case of the Phantom Limousine (Coming Eventually)
The Imposter's Turnabout (Coming Maybe)
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Missing Runtime Expression Checkboxes

Post by Enthalpy »

I'll give this a look myself over the weekend. I need to familiarize myself with action_parameters.php (which is exactly the right file to start from) to offer advice, which is a file I've been meaning to learn for some time now.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
TimeAxis
Posts: 389
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English
Contact:

Re: [E] Missing Runtime Expression Checkboxes

Post by TimeAxis »

Okay, this is embarassing. It turns out that these checkboxes are not required after all. Manually entering expressions does work correctly. The issue was that I wasn't correctly using quotes around string values.

I think the issue that made me think it was broken was that when you select an object to reveal/delete, and then switch to advanced mode, the fields get automatically filled out like so, and don't have quote marks around them, even with the runtime expression checkbox checked:
Image
It being filled out like this by default might be a minor bug (I'm not going to say anything with confidence at this point), as when you replace one of the fields with a variable value, the whole thing breaks. But manually adding quotations to the other fields fixes this, and that was my bad for not trying that sooner.

On the plus side, I did do a bunch of experimenting at least, and figured out how these checkboxes would have been added if this feature was broken. Here's the post I'd made while I still thought it was broken, my shame preserved for posterity:
Spoiler : :
I've done a bit more experimenting and found a way to add the checkbox, and it seemed to be working without issue (including accepting expression input) on my end. Here's what I did:

On Line 295 of editor_actions.js, replace:

Code: Select all

else if(!hasUnresolvableType)
with

Code: Select all

else
There's a comment that says this:

Code: Select all

// Unless there is an unresolvale type : expression input is forced so no checkbox.
Based on my read of that (albeit without having the full picture), my impression is that it's the intention for it to accept expression input without any need for the checkbox, and the only reason it's not there is due to it being redundant. But this is clearly not working. I would presume that the proper way to fix this and have it be working as intended would be to figure out why that's not working and fix that, but just adding the checkbox is a quick fix that eliminates the need for that. At the very least, nothing sticks out to me that would break upon adding the checkbox, and I didn't run into any issues in my testing.

If this isn't a horrible idea for some reason that I'm unaware of, and I were to make this into a pull request, is there any chance it could be wrapped up into the upcoming update?
You can consider this suggestion revoked, in any case. I jumped the gun.
Image
Question Arcs (Threads Coming Eventually)
ImageImageImageImage
Gaiden Episodes
Champion of Turnabouts ★
HALLOWEEN HERO
Other
Phoenix Wright: Ace Attornauts
The Curious Case of the Phantom Limousine (Coming Eventually)
The Imposter's Turnabout (Coming Maybe)
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Missing Runtime Expression Checkboxes

Post by Enthalpy »

Okay, I see. Then maybe some UI changes are in order...
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Post Reply