Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, DotBot

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » EXT_BV Question
Forum Rules | Mark all | Recent Posts

EXT_BV Question
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 15, 2009, 3:57 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

Okay I've converted my plr and act flags over to EXT_BV's, but I've got a question, as to how to proceed correctly.

currently I have:
 pmobindex->act = fread_bitvector( fp ) | ACT_IS_NPC;


I was just going to delete the end to make it like:
pmobindex->act = fread_bitvector( fp );


Would that cause any problems? I'm not really sure if that would be the correct way to go about it.
       
Post is unread #2 Dec 15, 2009, 4:48 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Well you wanna make sure that the mob is set as NPC ( non-player character ). So what I did is this:

pmobindex->act = fread_bitvector( fp );
xSET_BIT( pmobindex->act, ACT_IS_NPC );
       
Post is unread #3 Dec 15, 2009, 5:04 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

Thanks for the reply :)

I also have some more lines that are similar, and just to clearify for me:
pMobIndex->act = ACT_IS_NPC | ACT_PROTOTYPE;

&

pMobIndex->act = cMobIndex->act | ACT_PROTOTYPE;


So those would be the same way correct?
pMobIndex->act = ACT_IS_NPC;
xSET_BIT( pMobIndex->act, ACT_PROTOTYPE );

&

pMobIndex->act = cMobIndex->act;
xSET_BIT( pMobIndex->act, ACT_PROTOTYPE);


Sorry for the bother, I'm not to savvy at this yet, heh.
       
Post is unread #4 Dec 15, 2009, 6:34 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

If you are initially setting them then I prefer this method.


xCLEAR_BITS( pMobIndex->act );
xSET_BIT( pMobIndex->act, ACT_PROTOTYPE );
xSET_BIT( pMobIndex->act, ACT_IS_NPC );


Doing:
pMobIndex->act = cMobIndex->act;


Is fine, so that's okay, but for the other things, I like to clear the bits, then set each of them individually.
       
Post is unread #5 Dec 15, 2009, 7:16 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

Thanks for the help Keb.

I wound up doing:
xSET_BIT( pMobIndex->act, ACT_IS_NPC );
xSET_BIT( pMobIndex->act, ACT_PROTOTYPE );


to get past the compile error. But went back and added in the xCLEAR_BITS after your last post.

The plrflags seems to be working great, but still having some problems with the act flags as of now though.
They just dont seem to be working the way they should, upon invoking a mob, or having the (proto) when set as such,
but its good in act_info.c I'll just have to play around with it some more i reckon.

Thanks again.
       
Post is unread #6 Dec 15, 2009, 8:42 pm
Go to the top of the page
Go to the bottom of the page

Andril
Magician
GroupMembers
Posts147
JoinedJun 9, 2009

What exactly is going on that they're not working properly? Are flags getting set or cleared apparently at random or something?
       
Post is unread #7 Dec 15, 2009, 11:49 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

Well, I think I've solved most of the problems, but the prototype flag just doesnt seem to be working. If i set a mob as a prototype it will set it as having the flag, but doesnt act like it has the flag. I've been checking everything but I still having found the cause. The (proto) prefix doesnt show either. Its just hard for me to say, It may have been something i did unintentially. So thats why I didnt really bother going into further detail.
       
Post is unread #8 Dec 16, 2009, 9:33 am
Go to the top of the page
Go to the bottom of the page

Andril
Magician
GroupMembers
Posts147
JoinedJun 9, 2009

For the (PROTO) prefix you should check the show_char_to_char_0 function in act_info. That's about all I can suggest. Good luck getting whatever isn't acting right fixed.
       
Post is unread #9 Dec 16, 2009, 2:12 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Did you make sure that act_flags in build.c matches up with your ACT_ flags in mud.h, sometimes that can cause problems similar to what you are describing.
       
Post is unread #10 Dec 16, 2009, 6:00 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

Though I had already fixed the issue, very good call, as that was the problem.
In build.c I left r28, r29, and r31. corrected it and now the protoflag works fine.

But, and there is always a but..

That brought about another problem, oddly enough. Pre-existing mobs are fine, but the
new ones ive add in, like the Sith Elite Troopers, persay, are not. They set fine, but if you
happen to mstat, in this case 26-37, no matter what flags are set. Segmentation fault.

Program received signal SIGSEGV, Segmentation fault.
mudstrlcat (dst=0x821db80 "npc prototype ",
    src=0x75007076 <Address 0x75007076 out of bounds>, siz=4096) at db.c:6406
6406      while( *s != '\0' )


backtrace is:
#0  mudstrlcat (dst=0x821db80 "npc prototype ",
    src=0x75007076 <Address 0x75007076 out of bounds>, siz=4096) at db.c:6406
#1  0x080f0fa0 in ext_flag_string (bitvector=0x831daf4, flagarray=0x81b9e60)
    at ext_bv.c:186
#2  0x0808fd2c in do_mstat (ch=0x82d8330, argument=0xbffff7f2 "26";)
    at act_wiz.c:1301
#3  0x0810ae6e in interpret (ch=0x82d8330, argument=0xbffff7f2 "26";)
    at interp.c:358


Also another thing i noticed is that all the mobs im invoking have 1000/0 force :/
Have any idea what is going on there?
Thanks for all the help so far. :)



       
Post is unread #11 Dec 16, 2009, 6:59 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

well if it happens again you need to type in frame 1 and take a look at the info in there for everything. My guess would be that something still isn't lined up right for those. Normally if it gives a crash in there it's looking for something that isn't got a spot in the part in build.c for it. If you get a chance post what is on the line for frame 1 as well as the parts it is using in build.c and mud.h for it.
       
Post is unread #12 Dec 16, 2009, 7:13 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

So only mobs that you minvoke are messed up? Is that correct?
       
Post is unread #13 Dec 16, 2009, 7:54 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

No its just the newer mobs i've added in. I can minvo 24 and its just fine, if i minvo 26(which ive added) it doesnt like it.

This is frame 1-3
(gdb) frame 1
#1  0x080f0fa0 in ext_flag_string (bitvector=0x831daf4, flagarray=0x81b9e60)
    at ext_bv.c:186
186             mudstrlcat( buf, flagarray[x], MAX_STRING_LENGTH );
(gdb) frame 2
#2  0x0808fd2c in do_mstat (ch=0x82d8330, argument=0xbffff7f2 "26";)
    at act_wiz.c:1301
1301          ch_printf( ch, "Act flags: %s\r\n", ext_flag_string( &victim->act, act_flags ) );
(gdb) frame 3
#3  0x0810ae6e in interpret (ch=0x82d8330, argument=0xbffff7f2 "26";)
    at interp.c:358
358        ( *cmd->do_fun ) ( ch, argument );


Yeah thats what I figured Rem, and its odd it only started doing this after I removed the BV stuff from act_flags in build.c I.E. r28, r29, and then r31.
The thought has crossed my mind to thrown them back in and take them out one at a time, but its getting hard to pull off since mah kid has been
wanting my attention all freakin day now.

Anyway, maybe that will help, maybe not. mstat works fine on players, fine on stock mobs it seems. just to clearify, and i can minvo those just fine.

       
Post is unread #14 Dec 16, 2009, 8:40 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Well if you get a chance post what you have in build.c for the act_flags and the part that goes with it in mud.h.

also in frame 1 type "print x" and try "print flagarray[x]" might have to use what ever number x is. You will also need to make sure that you have an act_flag for it to show at what x is. But when we look at both of the act_flags parts someone might notice what the problem is.
       
Post is unread #15 Dec 16, 2009, 9:33 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

oh, sorry bout that. got distracted. :)
Okie, here is what I have in mud.h:

/*
 * ACT bits for mobs.
 * Used in #MOBILES.
 */  
typedef enum
{
   ACT_IS_NPC, ACT_SENTINEL, ACT_SCAVENGER, ACT_IS_SURGEON, ACT_IS_QUESTMASTER,
   ACT_AGGRESSIVE, ACT_STAY_AREA, ACT_WIMPY, ACT_PET, ACT_TRAIN, ACT_PRACTICE,
   ACT_IMMORTAL, ACT_DEADLY, ACT_POLYSELF, ACT_META_AGGR, ACT_GUARDIAN,
   ACT_RUNNING, ACT_NOWANDER, ACT_MOUNTABLE, ACT_MOUNTED, ACT_SCHOLAR,
   ACT_SECRETIVE, ACT_POLYMORPHED, ACT_MOBINVIS, ACT_NOASSIST, ACT_NOKILL,
   ACT_DROID, ACT_NOCORPSE, ACT_PROTOTYPE
}actflags;


and this is build.c:

const char *const act_flags[] = 
{
   "npc", "sentinel", "scavenger", "surgeon", "questmaster", "aggressive", "stayarea",
   "wimpy", "pet", "train", "practice", "immortal", "deadly", "polyself",
   "meta_aggr", "guardian", "running", "nowander", "mountable", "mounted", "scholar",
   "secretive", "polymorphed", "mobinvis", "noassist", "nokill", "droid", "nocorpse",
   "prototype"
};


frame 1 'print x' :

$1 = 30


and 'print flagarray[x]':

$2 = 0x75007076 <Address 0x75007076 out of bounds>


Hrm, so obviously if its looking for 30, it wont find it. I'll go ahead and post the build.c act_flags, before modification:

const char *const act_flags[] = 
{
   "npc", "sentinel", "scavenger", "surgeon", "questmaster", "aggressive", "stayarea",
   "wimpy", "pet", "train", "practice", "immortal", "deadly", "polyself",
   "meta_aggr", "guardian", "running", "nowander", "mountable", "mounted", "scholar",
   "secretive", "polymorphed", "mobinvis", "noassist", "nokill", "droid", "nocorpse",
   "r28", "r29", "prototype", "r31"
};


The prototype flag wasn't working when they were like this, but works now. Lemme know whatcha think.
Thanks for the patience :P


       
Post is unread #16 Dec 17, 2009, 9:19 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Kk, looks good but somewhere its getting that 30 should be prototype so here is what I suggest.

In the build.c act_flags after the prototype add one for r29 r30 r31 so it doesnt crash and you can see what its setting etc.... You will probably have to check for how it sets the prototype flag up when creating stuff etc....
       
Post is unread #17 Dec 17, 2009, 2:49 pm
Go to the top of the page
Go to the bottom of the page

Xerix
Fledgling
GroupMembers
Posts15
JoinedDec 2, 2009

Thanks for all the help guys.

I added r29 r30 after prototype in the act_flags. and it works fine.
What was going on is, everything that had prototype set previously before
the conversion, was trying to access 30 for the proto flag, but it wasnt there
anymore. so i went through and changed the mobs so that they are set up
right, now I no longer need the extras.

Thanks again, Remcon and Keb! :P
       
Post is unread #18 Dec 17, 2009, 7:11 pm   Last edited Dec 17, 2009, 7:13 pm by Andril
Go to the top of the page
Go to the bottom of the page

Andril
Magician
GroupMembers
Posts147
JoinedJun 9, 2009

The problem was the for loop in ext_flag_string in db.c. for( x = 0; x < MAX_BITS; ++x ). It's looking for MAX_BITS, 32 I believe, and the number of act flags was only 29.

A possible way to handle it would be a minor edit of the ext_flag_string function to take an int, or short, of the max number of iterations for that for loop so that you never go over how many flags you have for any particular thing.

Something like this:
char *ext_flag_string( EXT_BV * bitvector, char *const flagarray[], short MAX_FLAGS )
{
   static char buf[MAX_STRING_LENGTH];
   int x;

   buf[0] = '\0';
   for( x = 0; x < MAX_FLAGS; ++x )
      if( xIS_SET( *bitvector, x ) )
      {
         mudstrlcat( buf, flagarray[x], MAX_STRING_LENGTH );
         mudstrlcat( buf, " ", MAX_STRING_LENGTH );
      }
   if( ( x = strlen( buf ) ) > 0 )
      buf[--x] = '\0';

   return buf;
}

Throw something along the lines of a MAX_ACT_FLAGS to the end of the act flags enum in mud.h, and for any other flag systems that were converted to extended bv's, and just pass that to ext_flag_string.

You would of course have to go through the code, changing all calls to ext_flag_string to add in the MAX_FLAGS part though. Might be more trouble then it's worth for some people. *shrug*

Of course, throwing those r29, r30 and r31 entries in so you have 32 in the flag arrays in build.c works as well. :)
       
Pages:<< prev 1 next >>