Welcome to the Builder Academy

Question MSDP Inventory

More
15 Nov 2017 21:29 #7099 by WhiskyTest
Replied by WhiskyTest on topic MSDP Inventory
Haha yeah, so I had two thoughts on equipment..
The easiest would be to do the same thing again, but sending out a new msdp.EQUIPMENT value.
The cooler option would be to combine it with inventory into a table, and adding a variable to distinguish between 'carried' and 'worn'. But I haven't figured out how to do that yet..

So here is the easy version, same steps as for Inventory:
Protocol.h
Code:
eMSDP_EQUIPMENT,
Protocol.c
Code:
{ eMSDP_EQUIPMENT, "EQUIPMENT", STRING_READ_ONLY },

Add immediately after Inventory
Code:
/* Equipment */ found = 0; buf[0] = '\0'; for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) { found = 1; snprintf(buf2, sizeof(buf2), "%s,", GET_EQ(ch, i)->short_description); strlcat(buf, buf2, sizeof(buf)); } } if (!found) snprintf(buf, sizeof(buf), "Nothing"); MSDPSetString( d, eMSDP_EQUIPMENT, buf);

Please Log in or Create an account to join the conversation.

More
04 Dec 2017 13:09 #7187 by krell
Replied by krell on topic MSDP Inventory
That's some nice work Whiskey. I'm a slowly, very slowly, moving everything over to msdp myself.

Please Log in or Create an account to join the conversation.

More
04 Dec 2017 14:46 #7189 by zusuk
Replied by zusuk on topic MSDP Inventory
Here is an example of MXP code usage on show_obj_to_char()
You can right click on objects in your inventory to interact with it based on object_type and you can click on it for default actions such as equipped gear will be removed with a click, etc.

This was written by Nashak for LuminariMUD a ways back:
Code:
if (mxp_type != 0) { one_argument(obj->name, keyword); switch (mxp_type) { case 1: // inventory // loop through to ensure correct item, i.e. 2.dagger, 3.armor, etc. for (temp_obj = ch->carrying; temp_obj; temp_obj = temp_obj->next_content) { // check if the temp_obj contains keyword in the name list if (isname(keyword, temp_obj->name)) { if (temp_obj->short_description == obj->short_description) // this is the item they are trying to interact with // or at least has the same short description break; else item_num++; } } if (item_num > 0) { sprintf(keyword1, "%d.%s", (item_num + 1), keyword); strcpy(keyword, keyword1); } if (GET_OBJ_TYPE(obj) == ITEM_WEAPON) strcpy(sendcmd, "wield"); else if (GET_OBJ_TYPE(obj) == ITEM_SCROLL) strcpy(sendcmd, "recite"); else if (GET_OBJ_TYPE(obj) == ITEM_POTION) strcpy(sendcmd, "quaff"); else if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) strcpy(sendcmd, "wear"); else if (GET_OBJ_TYPE(obj) == ITEM_WORN) strcpy(sendcmd, "wear"); else if (GET_OBJ_TYPE(obj) == ITEM_FOOD) strcpy(sendcmd, "eat"); else if (GET_OBJ_TYPE(obj) == ITEM_DRINKCON) strcpy(sendcmd, "drink"); else if (GET_OBJ_TYPE(obj) == ITEM_NOTE) strcpy(sendcmd, "read"); else if (GET_OBJ_TYPE(obj) == ITEM_SPELLBOOK) strcpy(sendcmd, "look in"); else if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) strcpy(sendcmd, "look in"); else if (GET_OBJ_TYPE(obj) == ITEM_AMMO_POUCH) strcpy(sendcmd, "look in"); else strcpy(sendcmd, "hold"); send_to_char(ch, "\t<send href='%s %s|drop %s|eat %s|hold %s|lore %s' hint='use/equip %s|drop %s|eat %s|hold %s|lore %s'>%s\t</send>", sendcmd, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, obj->short_description); break; case 2: // equipment send_to_char(ch, "\t<send href='remove %s'>%s\t</send>", keyword, obj->short_description); break; } } else { send_to_char(ch, "%s", obj->short_description); }

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100
The following user(s) said Thank You: WhiskyTest

Please Log in or Create an account to join the conversation.

More
04 Dec 2017 22:10 #7202 by WhiskyTest
Replied by WhiskyTest on topic MSDP Inventory
Zusuck that is awesome!

I'm thinking of redoing the above inventory code and combining it with equipment into a table.

Please Log in or Create an account to join the conversation.

More
05 Dec 2017 00:22 #7206 by Ornir
Replied by Ornir on topic MSDP Inventory
Hey guys,
If you can wait a day or two I will have an update_msdp_inventory(char_data *ch) function I can share that will provide all the functionality you need.

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100

Please Log in or Create an account to join the conversation.

More
05 Dec 2017 01:39 #7207 by WhiskyTest
Replied by WhiskyTest on topic MSDP Inventory
Absolutely, yes

Please Log in or Create an account to join the conversation.

Time to create page: 0.320 seconds