/modify command
Moderator: Team Members
- Cynnar
- Project Leader
- Posts: 738
- Joined: Sat Sep 27, 2014 1:22 am
- EQ2Emu Server: Eq2emulator
- Characters: Vlash
Veinlash
Taragak
Cynnar
Re: /modify command
I just hope I get an A for effort. 
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Re: /modify command
I assume this is in "/modify spawn" so the actual command in game would be "/modify spawn door"
If that is the case then you want to check against the 0 index for door
Also this line can cause a lot of problems
GetTarget() will only return a Spawn* and then you forcing it to a widget, the problems comes when some on uses this command on a spawn that is not actually a widget so you don't want to do it like this, you first want to get a Spawn* check to see if it is valid and check to see if it is a widget, something like this
If that is the case then you want to check against the 0 index for door
Code: Select all
if (strcmp(sep->arg[0], "door") == 0) {
Code: Select all
Widget* target = (Widget*)client->GetPlayer()->GetTarget();
Code: Select all
Spawn* target = client->GetPlayer()->GetTarget();
if (target && target->IsWidget()) {
Widget* widget = (Widget*)target;
// now you can use the widget pointer without casting it to anything like so
widget->GetIncludeHeading();
}
- Cynnar
- Project Leader
- Posts: 738
- Joined: Sat Sep 27, 2014 1:22 am
- EQ2Emu Server: Eq2emulator
- Characters: Vlash
Veinlash
Taragak
Cynnar
Re: /modify command
As always Jab you are the man. Yes this is in the /modify spawn command
I dunno how, or why, I got arg[1] instead of arg[0], but I did.
Since modify is to replace the old commands to make /modify spawn door details to replace the spawn details command?
I dunno how, or why, I got arg[1] instead of arg[0], but I did.
I guess it would be better to have
Code: Select all
if (strcmp(sep->arg[0], "door") == 0)
{
if (strcmp(sep->arg[1], "details") == 0)
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Re: /modify command
I think "/modify spawn details" would be the best bet to replace /spawn details, that way you don't need to make a details command for each type (widget, npc, sign, etc...)
- Cynnar
- Project Leader
- Posts: 738
- Joined: Sat Sep 27, 2014 1:22 am
- EQ2Emu Server: Eq2emulator
- Characters: Vlash
Veinlash
Taragak
Cynnar
Re: /modify command
Ok so I have copied over the spawn details code to modify spawn details. Tested and it works.
I have noticed when you get the details (in both commands) it will print the type for the spawn id.
Which is ok if it is the only id. If I add in the information from the spawn_widget table then we have spawn_id, and widget id and it might become confusing since the message shows Widget ID: 1841456 when the actual widget id is 473155622 in the spawn_widget table. Would it be better to have it display Widget Spawn ID instead of the Widget ID? I also assume that the id, not spawn_id or widget_id, in the spawn_widgets table would be ok to leave out of the details command, but if it needs to be there as well it is something else to make clear also.
What about displaying include_heading with a Yes or No instead of 0 or 1? It makes it easier to read with the Yes and No.
Edit: When I add in this code
I get a warning C4804: '>' : unsafe use of type 'bool' in operation. Should I do this a different way?
I have noticed when you get the details (in both commands) it will print the type for the spawn id.
Code: Select all
client->Message(CHANNEL_COLOR_YELLOW, "Name: %s, %s ID: %u", spawn->GetName(), type, spawn->GetDatabaseID());What about displaying include_heading with a Yes or No instead of 0 or 1? It makes it easier to read with the Yes and No.
Edit: When I add in this code
Code: Select all
((Widget*)spawn)->GetIncludeHeading() > 0 ? "Yes" : "No"[ 01000011 01111001 01101110 01101110 01100001 01110010 ]
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Re: /modify command
Really it would be fine to have it as ID: for the spawn id and no need to include widget at all at this point. The ID in the widgets table doesn't need to be included, it can be looked up with the spawn id.
GetIncludeHeading() returns a bool it look like from that warning and you compare it to an int, visual studio tends to not like that so you could just change the " > 0" to "== true"
GetIncludeHeading() returns a bool it look like from that warning and you compare it to an int, visual studio tends to not like that so you could just change the " > 0" to "== true"
- Cynnar
- Project Leader
- Posts: 738
- Joined: Sat Sep 27, 2014 1:22 am
- EQ2Emu Server: Eq2emulator
- Characters: Vlash
Veinlash
Taragak
Cynnar
Re: /modify command
I'm going to replace the door with widget so the command will be /modify spawn widget. This way the command can be entered as /modify spawn widget heading, or /modify spawn widget type. I think that would make more sense in the end.
Thoughts on this anyone?
Edit:
I was wondering if I should spend more time on moving each of the spawn details items to its own line? Here is a screenshot of the first few in the list.
Thoughts on this anyone?
Edit:
I was wondering if I should spend more time on moving each of the spawn details items to its own line? Here is a screenshot of the first few in the list.
You do not have the required permissions to view the files attached to this post.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
- Cynnar
- Project Leader
- Posts: 738
- Joined: Sat Sep 27, 2014 1:22 am
- EQ2Emu Server: Eq2emulator
- Characters: Vlash
Veinlash
Taragak
Cynnar
Re: /modify command
Here is what I am going for with the spawn details command.
You do not have the required permissions to view the files attached to this post.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Who is online
Users browsing this forum: No registered users and 0 guests