obj flag

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago #6331 by JTP
JTP created the topic: obj flag
I made an obj flag called Champion

So what i would like is, if an item is flaged Champion then when the item is worn it looks like:

<worn around neck> <Champion> a black collar



So infront of the worn item show that its a Champion item. How would that be done and where ?

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

More
1 year 5 months ago #6333 by WhiskyTest
WhiskyTest replied the topic: obj flag
in act.informative.c
static void show_obj_to_char() around line #117
+ if (OBJ_FLAGGED(obj, ITEM_CHAMPION))
+   send_to_char(ch, "<Champion> ");

send_to_char(ch, "%s", obj->short_description);
break;

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago #6334 by JTP
JTP replied the topic: obj flag
How if i wanted color on it ? @M @n doesnt Work here

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

  • Vatiken
  • Vatiken's Avatar
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
1 year 5 months ago #6335 by Vatiken
Vatiken replied the topic: obj flag
"\tM<Champion>\tn "
Would put it in the colour magenta.
Within the code "\t" aka tab takes the place of the "@" for security purposes.

tbaMUD developer/programmer

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago - 1 year 5 months ago #6336 by JTP
JTP replied the topic: obj flag
Thanks alot Vatiken, that worked.
Last Edit: 1 year 5 months ago by JTP.

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago #6337 by JTP
JTP replied the topic: obj flag
How ever vnum doesnt <champion> any ideas how to get it to ?

Do_vnum only seems to be replies if arg doesnt exists.

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

More
1 year 5 months ago #6340 by WhiskyTest
WhiskyTest replied the 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.

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago #6350 by JTP
JTP replied the 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
1 year 5 months ago #6358 by WhiskyTest
WhiskyTest replied the 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.

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago #6369 by JTP
JTP replied the 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.

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago - 1 year 5 months ago #6376 by JTP
JTP replied the 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: 1 year 5 months ago by JTP.

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

More
1 year 5 months ago #6380 by WhiskyTest
WhiskyTest replied the 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
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.

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago - 1 year 5 months ago #6384 by JTP
JTP replied the topic: obj flag
It Works, though it breaks line after 0


Which object extra flag do you want to list?
0-GLOW
1-HUM 2-NO_RENT 3-NO_DONATE 4-NO_INVIS
5-INVISIBLE 6-MAGIC 7-NO_DROP 8-BLESS



Also
Any suggestions to why my olist type, shows all it should, but if i pick olist type followed by the number of one of the new types that i have made, then it says:

Not a valid item type see pic alittle further up in this thread.

Anything i need to do to get olist to show the new types ?
Last Edit: 1 year 5 months ago by JTP.

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

More
1 year 5 months ago #6385 by WhiskyTest
WhiskyTest replied the topic: obj flag
Ah OK.. so you will need to add your new item types into this function:
perform_obj_type_list()

Here is an example:
          /* The 'normal' items - don't provide extra info */
+         case ITEM_FISHING_POLE
+         case ITEM_HERB_TOOL
+         case all your other custom item types here
          case ITEM_TREASURE:
          case ITEM_TRASH:
          case ITEM_OTHER:
          case ITEM_WORN:
          case ITEM_NOTE:
          case ITEM_PEN:
          case ITEM_BOAT:
          case ITEM_KEY:
            tmp_len = snprintf(buf+len, sizeof(buf)-len,"%s%3d%s) %s[%s%8d%s] %s%s\r\n",
                 QGRN, ++found, QNRM, QCYN, QYEL, ov, QCYN, obj_proto[r_num].short_description, QNRM);
            break;

          default:
            send_to_char(ch, "Not a valid item type");
            return;

This will fix that line break at 0:
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");
+ if (!((i+1)%4)) send_to_char(ch, "\r\n");

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 5 months ago #6386 by JTP
JTP replied the topic: obj flag
Thanks alot, much apreciated. Works perfect, nice update to olist.

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

Time to create page: 1.686 seconds