Question: The "Commands" structure

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Question: The "Commands" structure

Post by John Adams » Sun Jun 01, 2008 9:16 am

I am standing in Graystone Yard, staring at the Norrathian Express mailbox. I can see it glow when I mouse over, plus the title of the object pops up. There is even a right-click "Check Mail" option! So all looks good up til this point (I know there is zero code to support this yet, but that's not the question ;))
So I go to my spawn_widgets table, dig through and find the mailbox entry, track it's ID back to the spawns table where I find "Mail Kiosk".
When I DO click Check Mail, I see nothing in the console. I am assuming this is because there is no "check mail" command in the commands table. There are 3 tables I can see that might affect how a command works; `entity_commands`, `command_list`, and finally `commands`. I believe I understand what these tables do... so I am inserting a record into `command_list` in hopes to get some feedback from the console (like unhandled opcode or something) to begin a little experiment in development. :)
Now for the meat of the question. If I, a total noob to EQ2emu dev, wanted to pick a system to work on and start somewhere... is this the right place to start? Find a Command that doesn't work, and build some code to support it? Or am I just asking for trouble by not knowing shit and guessing?
I'd love to help out in this aspect - non-critical systems development - where I can. But it'll be slow going for me, since I am not too confident in this area, heh. If you (LE) do not have time for Q&A, I understand. Just tossing it out here in case anyone is a seasoned dev that might give me a pointer or two.
TIA,
-J

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Sun Jun 01, 2008 6:21 pm

The only seasoned dev here is me, but I'll try to answer your questions :P
Here is an explanation on how these commands work:
1. World uses the command_primary and command_secondary fields in the spawn table to get a list of commands for a particular spawn. These fields point to the command_list_id field in the entity_commands table.
2. There are two id type fields in the entity_commands table. The id field is used only for determining order if a particular command_list_id is used more than once. This allows someone to put multiple commands on a single command_list_id. The lowest id for a given command_list_id is automatically the default action. When adding entity commands if you assign more than 1 command to the same command_list_id, be sure to make the one you want as the default is added first (has a lower value in the id field).
3. The command_text field is the message that is displayed when a user right clicks on the spawn and the command field is the command that is used if a user selects that option. The distance field is the max distance that a user is allowed to select a particular option. I can't remember if the error_text field is currently used, but it is to alert the user as to why they are not allowed to select an option.
4. When a user clicks on a entity command option, the OP_EntityVerbsVerbMsg opcode is sent to the World server. The code for handling this is in client.cpp. The code checks the spawn type and does different things based on that type. If it is a sign or a widget, then it calls the HandleUse function for each class. The only type of sign that is handled right now is a zone sign type. All other sign requests are ignored. Same with widgets, the only widget type handled right now are doors. That is why it doesnt display anything in your window for mail. Now, if a spawn is not a Widget or Sign it will attempt to execute the command like any other command the client tries to send. This means that if the command is invalid it will display an error message in the console window.
Note: The command_list table is old and shouldnt be used anymore. The entity_commands table took it's place.
If you have any other questions let me know.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Post by John Adams » Mon Jun 02, 2008 12:25 am

In an effort to try and teach myself something, I thought I'd play around locally with getting the world to respond to a request to "Check Mail". I'll let you know how I do. :)
Thank you for the great write up. That helps a great deal. I have also dropped table `command_list` from the SVN. I didn't know it was obsolete. Thanks!
-J

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests