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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  archery

archery

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


Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Sat 06 Dec 2003 07:45 AM (UTC)
Message
i took archery.c from samson's snippet page. i put it all in and did every intricate detail i could. then i compiled and came up with:




archery.c(491) : error C2065: 'PROJ_STONE' : undeclared identifier
archery.c(661) : error C2065: 'gsn_archery' : undeclared identifier
archery.c(662) : error C2065: 'gsn_blowguns' : undeclared identifier
archery.c(663) : error C2065: 'gsn_slings' : undeclared identifier
archery.c(1191) : error C2065: 'PROJ_BOLT' : undeclared identifier
archery.c(1191) : error C2051: case expression not constant
archery.c(1192) : error C2065: 'PROJ_ARROW' : undeclared identifier
archery.c(1192) : error C2051: case expression not constant
archery.c(1193) : error C2065: 'PROJ_DART' : undeclared identifier
archery.c(1193) : error C2051: case expression not constant
archery.c(1194) : error C2051: case expression not constant
Error executing cl.exe.


how would i go about declaring those things?

thanks for help
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #1 on Sat 06 Dec 2003 07:50 AM (UTC)
Message
Looks like you forgot to add a bunch of constants/variables to mud.h or something.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #2 on Sat 06 Dec 2003 08:04 AM (UTC)

Amended on Sat 06 Dec 2003 08:05 AM (UTC) by Ithildin

Message
what i did was put int PROJ_STONE and so on at the top of the function. and now all i have is

if( bow->value[5] != arrow->value[4] )
    {
	char *msg = "You have nothing to fire...\n\r";

      switch( bow->value[5] )
      {
        case PROJ_BOLT:	 msg = "You have no bolts...\n\r";	break;
        case PROJ_ARROW: msg = "You have no arrows...\n\r";	break;
        case PROJ_DART:	 msg = "You have no darts...\n\r";	break;
        case PROJ_STONE: msg = "You have no slingstones...\n\r";	break;
      }
	send_to_char( msg, ch );
	return;
    }


here is the error message:

archery.c(1191) : error C2051: case expression not constant
archery.c(1192) : error C2051: case expression not constant
archery.c(1193) : error C2051: case expression not constant
archery.c(1194) : error C2051: case expression not constant


how do i make those constant
[Go to top] top

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #3 on Sat 06 Dec 2003 08:11 AM (UTC)

Amended on Sat 06 Dec 2003 08:33 AM (UTC) by Ithildin

Message
ok, i'm lookin and i think i need a default but i don't know what to put default or if i even need one. here's the whole function.

[code]

void do_fire( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim = NULL;
OBJ_DATA *arrow;
OBJ_DATA *bow;
sh_int max_dist;
int PROJ_STONE;
int PROJ_BOLT;
int PROJ_ARROW;
int PROJ_DART;


if( ( bow = get_eq_char( ch, WEAR_MISSILE_WIELD ) ) == NULL )
{
send_to_char( "But you are not wielding a missile weapon!!\n\r", ch );
return;
}

one_argument( argument, arg );
if ( arg[0] == '\0' && ch->fighting == NULL )
{
send_to_char( "Fire at whom or what?\n\r", ch );
return;
}

if( !str_cmp( arg, "none" ) || !str_cmp( arg, "self" ) || victim == ch )
{
send_to_char( "How exactly did you plan on firing at yourself?\n\r", ch );
return;
}

if( ( arrow = get_eq_char( ch, WEAR_HOLD ) ) == NULL )
{
send_to_char( "You are not holding a projectile!\n\r", ch );
return;
}

if( arrow->item_type != ITEM_PROJECTILE )
{
send_to_char( "You are not holding a projectile!\n\r", ch );
return;
}

/* modify maximum distance based on bow-type and ch's class/str/etc */
max_dist = URANGE( 1, bow->value[4], 10 );

if( bow->value[5] != arrow->value[4] )
{
char *msg = "You have nothing to fire...\n\r";

switch( bow->value[5] )
{

case PROJ_BOLT: msg = "You have no bolts...\n\r"; break;
case PROJ_ARROW: msg = "You have no arrows...\n\r"; break;
case PROJ_DART: msg = "You have no darts...\n\r"; break;
case PROJ_STONE: msg = "You have no slingstones...\n\r"; break;
}
send_to_char( msg, ch );
return;
}

/* Add wait state to fire for pkill, etc... */
WAIT_STATE( ch, 6 );

/* handle the ranged attack */
ranged_attack( ch, argument, bow, arrow, TYPE_HIT + arrow->value[3], max_dist );

return;
}

[/code]

thanks for any help on this. i'm goin to bed. heh, i've been workin too long on this.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #4 on Sat 06 Dec 2003 09:14 AM (UTC)
Message
No, those shouldn't be ints, those should be constants of the form:
#define PROJ_STONE ???
where the ??? is the right number. I'd be a little surprised if those aren't in the snippet package somewhere... and they'd usually go into mud.h.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #5 on Sat 06 Dec 2003 07:29 PM (UTC)
Message
they weren't in the snippet. i looked like 5-6 times.

so i put #define PROJ_STONE 1 in mud.h

what number would i put at the end?

also, for the gsn_archery errors, i did the same thing

int gsn_archery;
int gsn_blowguns;
int gsn_slings;

so i'm guessin those aren't right either. would i define those as well?
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #6 on Sat 06 Dec 2003 07:32 PM (UTC)
Message
I'd try getting in touch with Samson to ask him about the defines... you probably don't want to put in random numbers there.

For the gsns, there should be a whole pile of:
extern int gsn_something_or_other;
in mud.h, and then in db.c those gsns are assigned the skill numbers from skill name lookups. Didn't the snippet ask you to do that too? Hmm... sounds like an incomplete snippet... :P

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #7 on Sat 06 Dec 2003 07:41 PM (UTC)
Message
hehe, yea it might be. thanks for all your help. i'll go look at it all and check out what i can find.

thanks so much. be back in a few...i hope
[Go to top] top

Posted by Samson   USA  (683 posts)  [Biography] bio
Date Reply #8 on Sun 07 Dec 2003 11:14 AM (UTC)
Message
As was mentioned on our forums, the archery code requires the weapon profficiency patch to work. If that's not installed, then you'll get errors and the like, much like these.
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #9 on Tue 10 Feb 2004 02:17 AM (UTC)
Message
Hmmm. I put in the weapon proficiency code, compiled, and checked it out. Worked great too.
But when I put in the archery code I get the same errors as above. I have since gone back through and checked both the weapon proficiency instructions and files, and now the archery ones, and I have followed them to a t.
Maybe I am misreading an instruction somehow? The archery system sounds very cool. I'm going back to see if maybe the copy of either archery snippet or weapon prof snippet was updated/changed. Maybe I have an older version of one or the other. Anybody have a clue? How did you make out with it, Ithildin?
Gadush
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #10 on Tue 10 Feb 2004 03:54 AM (UTC)
Message
Forget it, it was me. I somehow put the old files back into src before making clean and compiling. Doh! Apologies all. I went through each file and fixed it up, and it is working now.
Thanks,
Gadush
[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.


23,927 views.

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]