Create account / Log in

Pass Key Commands to Other Pieces

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Pass Key Commands to Other Pieces

Postby twenck » January 13th, 2019, 8:36 pm

Does anyone know of a way for key commands executed on one piece to be passed to another piece?

For example, if the player executes ALT A on Ship 1, ALT A is also executed on Ship 2.

Now, I know all about global key commands. So I can set it up such that if ALT A executes on Ship 1 it also sends a global key command to execute on Ship 2. But I am looking for a way to pass all key commands from one piece to another, without defining several traits and properties for every single command to be passed. So, any key command executed on piece #1 is passed to and executed on piece #2.

Alternatively, a way to have a piece always synchronized (in property values) to another piece would accomplish the same thing.


Thanks for giving this some thought.

Tom W
twenck
 
Posts: 28
Joined: October 27th, 2017, 11:15 pm

Re: Pass Key Commands to Other Pieces

Postby barbanera » January 14th, 2019, 12:08 pm

With global key commands: just use one on Ship 1 to fire a trigger on Ship 2 which runs all necessary commands there, and viceversa.

Without global key commands but "synchronizing" properties (*NOT* running commands): use global properties and have Ship1 and Ship2 use those (of course this only works if there are only a few combination of ships, not for dozens of them).
barbanera
 
Posts: 376
Joined: January 12th, 2012, 2:27 pm

Re: Pass Key Commands to Other Pieces

Postby twenck » January 14th, 2019, 2:16 pm

barbanaera - thanks for the reply.

I don't understand how a single trigger on Ship 2 can be capable of executing multiple commands, know which command was executed on Ship 1, and only execute that command.

For example, Ship 1 has 3 possible commands: ALT A, ALT B and ALT C. I can see how any of the three can execute a global key command that fires a trigger on Ship 2. But how does the trigger on Ship 2 know which command was executed on Ship 1, and fire only the one of those 3 commands that was executed on Ship 1?

It seems to me a separate global key command on Ship 1 and a separate trigger on Ship 2, for every single possible key command would be required. Hence, why I asked about "passing" any key command from Ship 1 to Ship 2. If there was a way to simply store the last key command executed on Ship 1 into a property and then have Ship 2 read that property, that should work.

Did I miss something about the trigger and there is a way to do as you suggest?
twenck
 
Posts: 28
Joined: October 27th, 2017, 11:15 pm

Re: Pass Key Commands to Other Pieces

Postby barbanera » January 14th, 2019, 5:59 pm

You are right. I misunderstood and thought you wanted to minimize the number of global key commands on Ship 1 to run a sequence of commands on Ship 2. If the sequence varies then of course you need multiple global key commands, anyway.

I don't think it would save you any time store the last key command in a global property and have a single global key command: Ship 2 would then need to parse that string in to understand what needs triggering. Just as many branches (and more conmplicated/confusing) as just having separate global key commands on Ship 1.

On the other hand, if the result of a ALT-A on Ship 1 and Ship 2 is the same (e.g. rotating a bunch of tokens or unmasking cards etc..) then you can simply select all involved ships at once and hit ALT-A only once. This fails if ALT-A involves user prompts, as you would get one prompt for each piece.
barbanera
 
Posts: 376
Joined: January 12th, 2012, 2:27 pm

Re: Pass Key Commands to Other Pieces

Postby twenck » January 14th, 2019, 8:30 pm

Thank you for the additional input.

The way I deal with it now, Ship 1 clones itself, sends itself to the same location as Ship 2, and deletes the original Ship 2. But this actually takes a huge amount of code to get it right in all possible circumstances.
twenck
 
Posts: 28
Joined: October 27th, 2017, 11:15 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 4 guests