Cross Profile Communication - CPC

Share your scripts and packages with other Mudlet users.
Post Reply
takilara
Posts: 24
Joined: Tue Jul 28, 2020 10:23 pm

Cross Profile Communication - CPC

Post 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

User avatar
Vadi
Posts: 4941
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cross Profile Communication - CPC

Post by Vadi »

Nice! Works well. As a reminder you need to install this package in all profiles you'd like to be hooked up,

beckham894
Posts: 14
Joined: Thu Aug 30, 2018 2:07 pm

Re: Cross Profile Communication - CPC

Post by beckham894 »

One more friendly reminder is that the profile name must be in one single word in order to make #bid command works.

User avatar
Vadi
Posts: 4941
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cross Profile Communication - CPC

Post by Vadi »

Indeed. Maybe the new getProfileTabNumber() function can be used here to specify the tab #?

beckham894
Posts: 14
Joined: Thu Aug 30, 2018 2:07 pm

Re: Cross Profile Communication - CPC

Post 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?

User avatar
Vadi
Posts: 4941
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cross Profile Communication - CPC

Post 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.

beckham894
Posts: 14
Joined: Thu Aug 30, 2018 2:07 pm

Re: Cross Profile Communication - CPC

Post by beckham894 »

Nope it was expandAlias problem. Using cps:handleCommand result is the same

Post Reply