Here's what i found out and might be useful to you who need more precise function.
Such as : Detecting specific chat room's titles and joining it.
IntroWe know that there's isn't any macro to check titles of chat room. So how do we identified chat room's title ? Have you ever notice how the console commands,
chat list ? Why is when you type
chat list, it will display number of chat rooms, titles, number of person in rooms, etc... ? Of course there's a function that retrieve titles !! and with eval() you can identify chat room's titles in your immediate area, also you will able to identify the name of NPC/Player created the chat room.
How-to:Browse into your /src/commands.pm
Here you'll find how your console command works. Start searching for "chat" and you'll be seeing this
cmdChatRoom next to it, now search for the latter terms.
You'll arrived where the additional syntax after "chat", there are "modify", "kick", "join", "leave", "create", "list", "info"
What we're interested here is "list"
observed how the code were written, and what variables and corresponding to titles. you'll notice that $room->{title} carries the chat room's titles; Actor::get($room->{ownerID})->name carries the name of the owner of the chat. So how do we called them? After trial-and-error and searching in forums , you'll found out that it requires
$:: in front of every variables.
take note that there are 2 types of eval in macro, the is condition eval which is :
eval () another is macro eval which is :
@eval()To cut-short, in order to retrieve owner of chat rooms in the immediate area (you need a counter; therefore you need to loop this function until you found your desire titles)
Code:
$foo = @eval(Actor::get($::chatRooms{$::chatRoomsID[$i]}->{ownerID})->{name} eq 'NPC/Player names')
note:
1)the $i is a counter, it will keep looping until it found your 'NPC/Player names' and also the number you required in
do chat join $i later.
2) '
NPC/Player names' is the name of Player/NPC(note that these names depends in /tables/npcs.txt) created the chat rooms. e.g.: RegistrationRed (in Battlegrounds)
Now when you join the chat room, you want to make sure the titles is correct after you join the chat room.
Code:
eval (($::chatRooms{$::currentChatRoom}->{title}) ne 'Chat Room Titles')
Where this condition will be triggered if the desire name is NOT
Chat Room Titles and therefore, leave the chat room and looking for a correct ones. e.g.:
Battle Station 5 PlayersNow those guys who want to prevent you from entering the correct chat room is wasted !! As you are now able to tell the name of the NPC who created the chat room titled
Battle Station 5 Players is
RegistrationRed and will only join this chat room but not others !!
Have fun ^^
Credit goes to EternalHarvest and DrKN