Page 1 of 1

Cross Profile Communication - CPC

Posted: Sun Feb 14, 2021 8:16 pm
by takilara
I've made a simple package that make it convenient to "send orders" to other profiles.

Package is here:
https://github.com/takilara/cpc/releases/latest

Currently supported commands:
  • #HELP - In game help
  • #ALL <command> - Asks all profiles to execute the command
  • #DO <command> - Asks all profiles except the current, to execute the command
  • #BID <profile> <command> - Ask the speficied profile to execute the command
I hope this is of help to someone.

regards

Re: Cross Profile Communication - CPC

Posted: Mon Feb 15, 2021 11:09 am
by Vadi
Nice! Works well. As a reminder you need to install this package in all profiles you'd like to be hooked up,

Re: Cross Profile Communication - CPC

Posted: Sun Mar 14, 2021 11:54 am
by beckham894
One more friendly reminder is that the profile name must be in one single word in order to make #bid command works.

Re: Cross Profile Communication - CPC

Posted: Sun Mar 14, 2021 1:17 pm
by Vadi
Indeed. Maybe the new getProfileTabNumber() function can be used here to specify the tab #?

Re: Cross Profile Communication - CPC

Posted: Sun Mar 14, 2021 7:17 pm
by beckham894
I also found one strange thing while testing the code.
lets say i have the below code setup:
Code: [show] | [select all] lua
sendAll("get water from bag", "give water to (profile A/B)", false)
expandAlias("#bid (profile A/B) put water in bag", false)
when fire from profile A, the code work perfectly. (profile A get water from bag and pass it to profile B then profile B put water in bag)

but when fire from profile B, somehow the #bid code is executed first in profile A then sendAll code is executed in profile B. (profile A put "water (which is none) in bag first then profile B get water from bag and pass it to profile A)

Any idea why?

Re: Cross Profile Communication - CPC

Posted: Mon Mar 15, 2021 6:43 am
by Vadi
I haven't tried it out, but this could be due to the use of expandAlias - I understand it's a bad habit from other clients. Try `cpc:handleCommand("big", "(profile A/B) put water in bag")` instead.

Re: Cross Profile Communication - CPC

Posted: Sat Mar 20, 2021 7:59 am
by beckham894
Nope it was expandAlias problem. Using cps:handleCommand result is the same

Re: Cross Profile Communication - CPC

Posted: Sun May 09, 2021 11:08 pm
by takilara
beckham894 wrote:
Sun Mar 14, 2021 7:17 pm
I also found one strange thing while testing the code.
lets say i have the below code setup:
Code: [show] | [select all] lua
sendAll("get water from bag", "give water to (profile A/B)", false)
expandAlias("#bid (profile A/B) put water in bag", false)
when fire from profile A, the code work perfectly. (profile A get water from bag and pass it to profile B then profile B put water in bag)

but when fire from profile B, somehow the #bid code is executed first in profile A then sendAll code is executed in profile B. (profile A put "water (which is none) in bag first then profile B get water from bag and pass it to profile A)

Any idea why?
Sorry, i didnt notice this message :(
I am not sure if the last message means that it is not an issue when using cpc:handleCommand or if the issue occurs with both modes.

I'll see if i can reproduce it, sounds really strange though, I dont really know how the sendAll works, it almost sounds like it gets placed onto the execution thread as an event, and for some reason it is then handled after the #BID event.

A workaround may be to use a tempTimer to force delay of the #BID command, though if handleCommand solves it, i would rather recommend using that.

(personally i use #BID for anything i execute manually, e.g. things i type in, or place on my F-keys. And i use cpc:handleCommand for anything i script)