how to comunication beetween room and zone

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
dekii
Posts: 6
Joined: 02 Oct 2024, 08:46

how to comunication beetween room and zone

Post by dekii »

i'm making a card game.The player can still auto playing on a room when offline, so i working on a custom list player, not a default user variable.
My game have a rules, when player out and number of players on a room < minNumberOnRoom, i need to check all another room to balance player rooms. So i need fire a event from room to my zone, and i dont know how to comunication beetween room and zone
I user sfs2x version
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: how to comunication beetween room and zone

Post by Lapo »

Hi,
all Extensions have a method that looks like this:

Code: Select all

Object handleInternalMessage(String cmdName, Object params)

which allows to send messages between extensions.

For example from the Zone you can do the following:

Code: Select all

var someRoom = zone.getRoomByName("SomeRoom");
someRoom.getExtension().handleInternalMessage("cmd", params);

You can also do the other way around:

Code: Select all

var myZone = someRoom.getZone();
myZone.getExtension().handleInternalMessage("cmd", params);

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
dekii
Posts: 6
Joined: 02 Oct 2024, 08:46

Re: how to comunication beetween room and zone

Post by dekii »

I solved it by your answer
Thank for your help. Have good day sir :D
Post Reply