Welcome to the Builder Academy

Question obj flag

More
05 Dec 2016 00:36 #6340 by WhiskyTest
Replied by WhiskyTest on topic obj flag
The 'vnum' command only looks at the object name, and <Champion> is not part of the object name.

Are you wanting to be able to list all objects with the <Champion> flag?
If so, I can't think of an easy way with the current commands.. olist, vnum, ..

I think there is certainly a market to have better searching/listing commands. I've often wanted to be able to list all weapons in a certain level range for example, to assist with game balancing. I'll ponder it..

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

More
05 Dec 2016 05:37 #6350 by JTP
Replied by JTP on topic obj flag
Yea, would be nice to be able to list all items flagged champion, to see what vnums they have in case having to load one.

List level range of a certain item type sounds cool to.

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

More
06 Dec 2016 01:22 #6358 by WhiskyTest
Replied by WhiskyTest on topic obj flag
I started looking at expanding the olist command and guess what - it's already in there! Mind blown!

check out:
olist help
Usage: olist <zone> - List objects in a zone
olist <vnum> <vnum> - List a range of objects by vnum
olist <name> - List all named objects with count
olist type <num> - List all objects of a specified type
olist affect <num> - List top 100 objects with affect
Just type olist affect or olist type to view available options

You could probably code in something that looked for item flags by copying the affect portion of it

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

More
06 Dec 2016 08:42 #6369 by JTP
Replied by JTP on topic obj flag
Yea i Can see olist has alot of Nice features. Under affects it lists alot of the new stuff i have added, but if i try olist affect num on some of the new stuff, Then it doesnt work. Maybe i need to adjust olist

But the option for champion isnt there at all :(

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

More
07 Dec 2016 21:33 - 07 Dec 2016 21:56 #6376 by JTP
Replied by JTP on topic obj flag
See it lists new options, but doesnt work


And the champion even listed under type either



If you come to think how vnum search could list it, that would be nice. Think that would be the way that I would search most.
Attachments:
Last edit: 07 Dec 2016 21:56 by JTP.

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

More
08 Dec 2016 05:02 #6380 by WhiskyTest
Replied by WhiskyTest on topic obj flag
Here is the patch to allow listing by extra affects!
All the changes happen inside oasis_list.c

Usage: olist extra <num>
Example: olist extra
Shows a list of all extra flags and the numbers you would use to search with

Example: olist extra 0
Shows a list of all objects with ITEM_GLOW set
Code:
src/oasis_list.c @@ -246,6 +246,40 @@ void perform_obj_type_list(struct char_data * ch, char *arg) page_string(ch->desc, buf, TRUE); } +void perform_obj_extra_list(struct char_data *ch, char *arg) +{ + int num, apply, found = 0; + size_t len = 0, tmp_len = 0; + obj_vnum ov; + char buf[MAX_STRING_LENGTH]; + + apply = atoi(arg); + + if (apply < 0 || apply >= NUM_ITEM_FLAGS) { + send_to_char(ch, "Not a valid extra flag\r\n"); + return; + } + + len = snprintf(buf, sizeof(buf), "Objects with the extra flag '%s'\r\n" + "Index VNum Num Object Name Object Type\r\n" + "----- ------- ----- ------------------------------------------ ----------------\r\n", extra_bits[apply]); + for (num = 0; num <= top_of_objt; num++) { + if (IS_SET_AR((obj_proto[num].obj_flags.extra_flags), apply)) { + ov = obj_index[num].vnum; + tmp_len = snprintf(buf+len, sizeof(buf)-len, "%s%4d%s) %s[%s%5d%s] %s(%s%3d%s)%s %-*s%s [%s]%s%s\r\n", + QGRN, ++found, QNRM, QCYN, QYEL, ov, QCYN, QNRM, + QGRN, obj_index[num].number, QNRM, QCYN, 42+count_color_chars(obj_proto[num].short_description), + obj_proto[num].short_description, QYEL, item_types[obj_proto[num].obj_flags.type_flag], QNRM, + obj_proto[num].proto_script ? " [TRIG]" : ""); + len += tmp_len; + if (len > sizeof(buf)) + break; + } + } + + page_string(ch->desc, buf, TRUE); +} + void perform_obj_aff_list(struct char_data * ch, char *arg) { int num, i, apply, v1 = 0, found = 0; @@ -439,9 +473,10 @@ ACMD(do_oasis_list) send_to_char(ch, " %solist <name>%s - List all named objects with count\r\n", QYEL, QNRM); send_to_char(ch, " %solist type <num>%s - List all objects of a specified type\r\n", QYEL, QNRM); send_to_char(ch, " %solist affect <num>%s - List top %d objects with affect\r\n", QYEL, QNRM, MAX_OBJ_LIST); + send_to_char(ch, " %solist extra <num>%s - List top %d objects with extra flag\r\n", QYEL, QNRM, MAX_OBJ_LIST); send_to_char(ch, "Just type %solist affect%s or %solist type%s to view available options\r\n", QYEL, QNRM, QYEL, QNRM); return; - } else if (is_abbrev(arg, "type") || is_abbrev(arg, "affect")) { + } else if (is_abbrev(arg, "type") || is_abbrev(arg, "affect") || is_abbrev(arg, "extra" )) { if (is_abbrev(arg, "type")) { if (!*arg2) { send_to_char(ch, "Which object type do you want to list?\r\n"); @@ -457,6 +492,22 @@ ACMD(do_oasis_list) return; } perform_obj_type_list(ch, arg2); + } else if (is_abbrev(arg, "extra")) { + if (!*arg2) { + send_to_char(ch, "Which object extra flag do you want to list?\r\n"); + for (i = 0; i < NUM_ITEM_FLAGS; i++) + { + send_to_char(ch, "%s%2d%s-%s%-14s%s", QNRM, i, QNRM, QYEL, extra_bits[i], QNRM); + if (!(i%4)) send_to_char(ch, "\r\n"); + } + send_to_char(ch, "\r\n"); + send_to_char(ch, "Usage: %solist extra <num>%s\r\n", QYEL, QNRM); + send_to_char(ch, "Displays top %d objects, in order, with the selected extra flag.\r\n", MAX_OBJ_LIST); + + return; + } + perform_obj_extra_list(ch, arg2); + } else { /* Assume arg = affect */ if (!*arg2) { send_to_char(ch, "Which object affect do you want to list?\r\n");
The following user(s) said Thank You: brmud

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

Time to create page: 0.237 seconds