[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Bout them invasions....

Bout them invasions....

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by Longbow   (102 posts)  [Biography] bio
Date Fri 15 Jul 2005 09:14 PM (UTC)
Message
Howdy folks! Long time no see! I just added the invade snippet by the folks at Lost Prophecy. Now the only error I'm getting is as follows:

request for member 'bits' in something not a structure or union


Which is speaking of this line of code:

if (xIS_SET( location->room_flags, ROOM_SAFE))

Now what would be the solution for this? I'm not sure I understand WHAT the error is.

Thanks,
Longbow
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #1 on Fri 15 Jul 2005 09:24 PM (UTC)
Message
What is location defined as? Doesn't sound like ROOM_DATA or the sort.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #2 on Fri 15 Jul 2005 09:50 PM (UTC)
Message
Chances are that room_flags is not an extended bit vector. But, you're using xIS_SET, not IS_SET. To fix this, you could probably use IS_SET - although you need to think about whether you want the room flags to be extended or not.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #3 on Sat 16 Jul 2005 07:48 PM (UTC)

Amended on Sat 16 Jul 2005 07:50 PM (UTC) by Longbow

Message
Ok, what's the definition of an extended bit for rooms? Use layman's terms.

Longbow
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #4 on Sat 16 Jul 2005 08:14 PM (UTC)
Message
See:
http://www.auricmud.com/snippets/bitvectors.html

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #5 on Sat 16 Jul 2005 08:34 PM (UTC)
Message
This is what I get if I remove that simple little x in xIS_SET.


invade.c:8: error: parse error before '*' token
invade.c: In function `do_invade':
invade.c:10: error: `MAX_INPUT_LENGTH' undeclared (first use in this function)
invade.c:10: error: (Each undeclared identifier is reported only once
invade.c:10: error: for each function it appears in.)
invade.c:13: error: `CHAR_DATA' undeclared (first use in this function)
invade.c:13: error: `victim' undeclared (first use in this function)
invade.c:14: error: `AREA_DATA' undeclared (first use in this function)
invade.c:14: error: `tarea' undeclared (first use in this function)
invade.c:16: error: `bool' undeclared (first use in this function)
invade.c:16: error: parse error before "found"
invade.c:17: error: `MOB_INDEX_DATA' undeclared (first use in this function)
invade.c:17: error: `pMobIndex' undeclared (first use in this function)
invade.c:18: error: `ROOM_INDEX_DATA' undeclared (first use in this function)
invade.c:18: error: `location' undeclared (first use in this function)
invade.c:20: error: `argument' undeclared (first use in this function)
invade.c:20: warning: implicit declaration of function `one_argument'
invade.c:23: warning: implicit declaration of function `atoi'
invade.c:26: warning: implicit declaration of function `send_to_char'
invade.c:26: error: `ch' undeclared (first use in this function)
invade.c:29: error: `first_area' undeclared (first use in this function)
invade.c:30: warning: implicit declaration of function `str_cmp'
invade.c:32: error: `found' undeclared (first use in this function)
invade.c:32: error: `TRUE' undeclared (first use in this function)
invade.c:45: warning: implicit declaration of function `get_mob_index'
invade.c:45: error: `NULL' undeclared (first use in this function)
invade.c:53: warning: implicit declaration of function `get_room_index'
invade.c:53: warning: implicit declaration of function `number_range'
invade.c:58: warning: implicit declaration of function `IS_SET'
invade.c:58: error: `ROOM_SAFE' undeclared (first use in this function)
invade.c:63: warning: implicit declaration of function `create_mobile'
invade.c:64: warning: implicit declaration of function `char_to_room'
invade.c:65: warning: implicit declaration of function `act'
invade.c:65: error: `AT_IMMORT' undeclared (first use in this function)
invade.c:65: error: `TO_ROOM' undeclared (first use in this function)
invade.c:10: warning: unused variable `arg1'
invade.c:11: warning: unused variable `arg2'
invade.c:12: warning: unused variable `arg3'
make[1]: *** [invade.o] Error 1
make: *** [all] Error 2
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #6 on Sat 16 Jul 2005 08:43 PM (UTC)
Message
If you want the original code for a look, here is invade.c unchanged:


/* Use cedit to add in as imm command.
 * Syntax is: Invade <area filename> <# of invaders> <vnum of mobs> 
 * example: Invade newacad.are 300 10399 would send 300 mistress tsythia's rampaging 
 * through the academy. This function doesnt make the mobiles aggressive but can be
 * modified to do so easily if you wish this, or you can just edit the mob before
 * hand.
 */
void do_invade( CHAR_DATA *ch , char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    char arg3[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    AREA_DATA *tarea;
    int count, created;
    bool found=FALSE;
    MOB_INDEX_DATA *pMobIndex;
    ROOM_INDEX_DATA *location;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    argument = one_argument( argument, arg3 );
    count = atoi( arg2 );
    if ( arg1[0] == '\0' || arg2[0] == '\0' )
    {
	send_to_char( "Invade <area> <# of invaders> <mob vnum>\n\r", ch );
	return;
    }
    for ( tarea = first_area; tarea; tarea = tarea->next )
	if ( !str_cmp( tarea->filename, arg1 ) )
	{
	  found = TRUE;
	  break;
	}
    if ( !found )
    {
	send_to_char( "Area not found.\n\r", ch );
	return;
    }
    if ( count > 300)
    {
	send_to_char( "Whoa...Less than 300 please.\n\r", ch );
	return;
    }
    if ( ( pMobIndex = get_mob_index( atoi(arg3) ) ) == NULL )
    {
	send_to_char( "No mobile has that vnum.\n\r", ch );
	return;
    }

    for ( created=0; created < count; created++ )
    {
	if ( (location = get_room_index(number_range(tarea->low_r_vnum, tarea->hi_r_vnum ))) == NULL )
        {
          --created;
	  continue;
        }
	if (xIS_SET( location->room_flags, ROOM_SAFE))
        {
          --created;
	  continue;
        }
        victim = create_mobile( pMobIndex );
        char_to_room( victim, location );
        act( AT_IMMORT, "$N appears as part of an invasion force!", ch, NULL, victim, TO_ROOM );
    }
	send_to_char( "The invasion was successful!\n\r", ch );

 return;
}


Longbow
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #7 on Sat 16 Jul 2005 10:40 PM (UTC)
Message
You forgot to include mud.h, but why not just put that function in a normal file?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #8 on Mon 18 Jul 2005 04:47 PM (UTC)
Message
Ok, I've fixed it. You guys were a bunch of help. Thanks a lot!

Godbless,
Longbow
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #9 on Mon 18 Jul 2005 09:44 PM (UTC)

Amended on Mon 18 Jul 2005 09:45 PM (UTC) by Longbow

Message
Ok, I put in a piece of code and I solved all the errors with it myself(ain't ya proud of me?) except this one:

'TO_ROOM' undeclared(first use in this function)

I put a bit of the code here with 5 asterisks by the error line.



                {
send_to_char( "You didn't realize it when you started, but you haven't enough material\n\r", ch);
                    return;
                }
                extract_obj( material );
         }
                 obj_to_char( clothing, ch );
         send_to_char("You snip and sew, creating a new piece of clothing.\n\r", ch);
act( AT_ACTION,"$n snips and sews, creating a new piece of clothing.", ch, NULL, NULL, T0_ROOM); *****
         xnum = number_range(0, 100);
         if (xnum < 25) /*did the sewkit break?*/
         {
                extract_obj( sewkit );
     act( AT_ACTION, "$n pulls too hard on the needle and it breaks!", ch, NULL, NULL, TO_ROOM);
                send_to_char( "You pull too hard on the needle and it breaks!\n\r", ch );
        }
        learn_from_failure( ch, gsn_tailor );
        return;
        }

 else  /* failure of skill */
        {
        for (x=number_range(1,9); x<=mnum; x++)
         {
                material = get_obj_carry (ch, arg1 );
                if (material == NULL)
                {
                      send_to_char( "Your thread knots, and your material is ruined.\n\r", ch);
                        return;
                }
                extract_obj( material );
         }
        send_to_char("You snip and sew, but only make a mess.\n\r", ch);
act( AT_ACTION, "$n snips and sews but doesn't make anything useful.", ch, NULL, NULL, TO_ROOM);
        xnum = number_range(0, 100);
        if (xnum < 25) /*did the sewkit break?*/
  {
                extract_obj( sewkit );
    act( AT_ACTION, "$n pulls too hard on the needle and it breaks!", ch, NULL, NULL, TO_ROOM);
                send_to_char( "You pull too hard on the needle and it breaks!\n\r", ch );
        }
                learn_from_success( ch, gsn_tailor );
        }
}


Any ideas?

Godbless,
Longbow
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #10 on Mon 18 Jul 2005 10:43 PM (UTC)
Message
Look carefully - you used the digit zero, not the letter 'o'. This is easy to spot when you use a font that marks the difference well. I use one that happens to do so nicely: http://david.the-haleys.org/faq/index.php?sid=95&lang=en&action=artikel&cat=3&id=2&artlang=en

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #11 on Tue 19 Jul 2005 02:08 PM (UTC)
Message
Good night! You're right! Wow, you're a good bit more observant than I. :) Thanks a bundle!

Godbless,
Longbow
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #12 on Tue 19 Jul 2005 02:18 PM (UTC)
Message
K, just when I think everything is solved I get a batch of errors I've never seen before:

skills.o(.text+0xf105): In function `do_dye.0':
/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6469: undefined reference to `_gsn_dye'
skills.o(.text+0xf142):/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6471: undefined reference to `_gsn_dye'
skills.o(.text+0xfa13):/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6599: undefined reference to `_gsn_dye'
skills.o(.text+0xfa82):/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6607: undefined reference to `_gsn_dye'
skills.o(.text+0xfac8): In function `do_tailor':
/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6275: undefined reference to `_gsn_tailor'
skills.o(.text+0xfb05):/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6277: undefined reference to `_gsn_tailor'
skills.o(.text+0x10322):/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6433: undefined reference to `_gsn_tailor'
skills.o(.text+0x10448):/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/skills.c:6458: undefined reference to `_gsn_tailor'
tables.o(.text+0x1560): In function `skill_function':
/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/tables.c:269: undefined reference to `_do_dye'
tables.o(.text+0x4d84): In function `skill_name':
/cygdrive/c/windows/desktop/bakups/textfinal/smaug1/smaug/dist/src/tables.c:949: undefined reference to `_do_dye'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make: *** [all] Error 2

I don't see anywhere where I put an extra _ in these examples.


Longbow
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #13 on Tue 19 Jul 2005 08:08 PM (UTC)
Message
You didn't, the _ is inserted by the compiler. Chances are you forgot to put the file you created in the list of files the makefile uses.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Longbow   (102 posts)  [Biography] bio
Date Reply #14 on Tue 19 Jul 2005 08:24 PM (UTC)
Message
I don't think so. It's a skill and I put it in skills.c, and I also removed it and tried it under a file of its own and still got the same message.

Godbless,
Longbow
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


43,825 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]