[engine] Design of [query_location]
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
[engine] Design of [query_location]
Idea description: https://github.com/wesnoth/wesnoth/issues/2325
I am looking for comments on how such function should work. Current plan:
Parameters
Result
Design
Cursor change is not possible.
Not sure how cancel should be reported.
I am looking for comments on how such function should work. Current plan:
Parameters
Code: Select all
-- location filter - unsure what to do when missing or when it matches no location
-- whether to fire old callback - or just disallow that if it allows attacking otherwise
-- WML variable for result - optional
-- custom confirm message - optional
-- custom overlay - optional
Code: Select all
Function returns table {x=x,y=y}
WML variable with .x and .y is created
Code: Select all
Overlay is added to all matching locations while selecting
Locations with fog/shroud are undecided how to handle
Ending turn is not possible while selecting
Attacking/moving/recruiting/basically everything I could think of to try is disabled
After selection there is confirm message to choose different hex
Not sure how cancel should be reported.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
My suggestions:
Location filter missing: select from entire map
Location filter, if present, must match at least one hex.
If filter only matches one hex, issue warning and select it automatically,
If filter matches no hex, issue error and select (-1, -1) in a (probably vain) attempt to proceed
Use (-1,-1) for cancel, just no error message logged.
Consider excluding fog/shroud from selection area by default and have options to enable it.
I envision an overlay masking non-selection area (ie., dark-gray/black where you can't select, normal map where you can)
And I envision another overlay showing what is selected (gold border?) click to toggle.
"Select All", "Select None" and "Toggle Selection" options might be good to have.
Options, default 1, for both min and max number of hex the player may select. Results are a table {x,y} or {{x,y},{x,y},...}
Translatable strings for title/heading and description.
While there should be fixed text about how, you do want to allow the UMC author someplace to explain the why.
Location filter missing: select from entire map
Location filter, if present, must match at least one hex.
If filter only matches one hex, issue warning and select it automatically,
If filter matches no hex, issue error and select (-1, -1) in a (probably vain) attempt to proceed
Use (-1,-1) for cancel, just no error message logged.
Consider excluding fog/shroud from selection area by default and have options to enable it.
I envision an overlay masking non-selection area (ie., dark-gray/black where you can't select, normal map where you can)
And I envision another overlay showing what is selected (gold border?) click to toggle.
"Select All", "Select None" and "Toggle Selection" options might be good to have.
Options, default 1, for both min and max number of hex the player may select. Results are a table {x,y} or {{x,y},{x,y},...}
Translatable strings for title/heading and description.
While there should be fixed text about how, you do want to allow the UMC author someplace to explain the why.
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
I might be missing something since I haven't read the proposal very carefully, but the filter only matching one hex doesn't sound like it should result in a warnings; if there are limits on the allowed locations, then it's pretty likely that you regularly end up with situations with only one possible choice due to unit placement, terrain, whatever.Tad_Carlucci wrote:If filter only matches one hex, issue warning and select it automatically,
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
Entirely possible we can both read the idea and see our own ideas because it's rather nebulous. So I'm sorta brainstorming without a clear use case in mind .. just let the player select some hexes. Maybe if there is only one choice, you should stop and ask to proceed with that choice pre-selected. I was thinking "From these coordinates (oops only one here)" and that is not quite the same as "From trees in within 3 hex of this unit (oops, there are none, or only one)"
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
Adding option to request multiple locations is something I hadnt thought of, but seems useful. However, then I need some other way for user input than just clicking on hex (wesnoth.game_events.on_mouse_action).
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
How do you select a unit without a mouse? Arrow keys and some sort of hex selection outline? Tabbing from unit to unit? Same problem. Just act like every possibly selected hex has a unit you can't see on it?
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
Yes, but with initial plan clicking on hex selected it and went to confirmation message. When allowing multiple locations then it would be better for user to not have to go through that message for each added location.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
Click on the unit, up pops a [message]-like area with icons and such.
"This unit has a Flame Thrower. Select up to 3 nearby forest tiles to attack this round."
"This unit has a Flame Thrower. Select up to 3 nearby forest tiles to attack this round."
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
Yes, that is what addon using this function might say.
I guess click to add location and next click on added location to finish might work.
I guess click to add location and next click on added location to finish might work.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
Or a row of buttons along the bottom.
"Select All" "Select None" "Toggle Selection" "Done" and "Cancel" with appropriate hot keys etc.
The unit is on desert with no forest near, so "Done" is greyed and disabled. Nothing can be selected (so all and toggle probably can be disabled, too) but the user is seeing they could, if conditions were right but for now it's just "Cancel"
"Select All" "Select None" "Toggle Selection" "Done" and "Cancel" with appropriate hot keys etc.
The unit is on desert with no forest near, so "Done" is greyed and disabled. Nothing can be selected (so all and toggle probably can be disabled, too) but the user is seeing they could, if conditions were right but for now it's just "Cancel"
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
How to add such buttons without blocking game execution?
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
It's just a multi-select [option]-like box with buttons instead of a list of items. Seems to me it's just UI details. But it may not be possible without a lot of work .. I've not looked at how options work except to debug a couple mainline campaigns which used them like issuing AI priorities to allies.
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
[option] is only available in [message] which blocks game. And buttons can only be added to Lua dialogs, which also blocks game.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: [engine] Design of [query_location]
I'm lost. I'm thinking of a way for UMC to let the player do something at a distance from the unit or to multiple locations (like the flame thrower, above). So, yes, it has to be the player's turn and while it's up they can't end turn.
I don't really see a point to select a hex while another player is taking their turn. As I said, I'm not real sure of the possible use cases so I'm going with the one which popped into my head.
I don't really see a point to select a hex while another player is taking their turn. As I said, I'm not real sure of the possible use cases so I'm going with the one which popped into my head.
I forked real life and now I'm getting merge conflicts.
Re: [engine] Design of [query_location]
Implementation where when selecting game is blocked already exists.
I want minimal interruptions to chat - only when confirming selection if unavoidable, and even then doubleclick based timings would be preferred.
I want minimal interruptions to chat - only when confirming selection if unavoidable, and even then doubleclick based timings would be preferred.