Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ object has no member??
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Kronos
USA (35 posts) Bio
|
| Date
| Sun 29 Dec 2002 11:01 AM (UTC) |
| Message
| im trying to put in this command that allows items to be connected together producing a final item.. now when i compile, it says:
act_obj.c: In function `do_connect':
act_obj.c:455: structure has no member named `level'
here's the part of the code in which it refers to:
/* check to see if the pieces connect */
if ( ( first_ob->value[0] == second_ob->pIndexData->vnum )
&& ( second_ob->value[0] == first_ob->pIndexData->vnum )
&& ( first_ob->value[1] == second_ob->value[1] )
&& (first_ob->pIndexData->vnum != second_ob->pIndexData->vnum) )
/* good connection */
{
new_ob = create_object( get_obj_index( first_ob->value[2] ), ch->level );/*!!!!!!!RIGHT HERE!!!!!!*/
extract_obj( first_ob );
extract_obj( second_ob );
obj_to_char( new_ob , ch );
act( AT_ACTION, "$n jiggles some pieces together...\r\n ...suddenly they snap in place, creating $p!", ch, new_ob,NULL, TO_ROOM );
act( AT_ACTION, "You jiggle the pieces together...\r\n ...suddenly they snap into place, creating $p!", ch, new_ob, NULL, TO_CHAR);
}
else
{
act( AT_ACTION, "$n jiggles some pieces together, but can't seem to make them connect.", ch, NULL, NULL, TO_ROOM);
act( AT_ACTION, "You try to fit them together every which way, but they just don't want to fit together.", ch, NULL, NULL, TO_CHAR);
Now what does it mean has no member? what do i need to do to fix it?
this is in the SWR codebase, of the act_obj.c file where i added it.
somebody please help!
-Kronos | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 30 Dec 2002 08:12 AM (UTC) |
| Message
| | Hmm - what is "ch" in this context? Can we see the declaration for it? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Kronos
USA (35 posts) Bio
|
| Date
| Reply #2 on Tue 31 Dec 2002 12:28 AM (UTC) |
| Message
| This is my act_obj.c file:
http://barbarian25.tripod.com/act_obj.c
and this is where im getting the code im trying to add from:
http://www.mindcloud.com/smaug/files/connect.c
Now as someone had suggested, i changed the origional ch->level to ch->top_level
It compiled no problem, and i put the command into the mud.
When i use it, it'll fail just fine, everything works except that when i actually connect the correct pieces, the mud crashes. So i have come to the conclusion that my changing ch->level to ch->top_level is the issue. but if i leave it as level, it does the structure has no member thing (previously mentioned in post farther up in this thread).
help if you can, thanks,
-Kronos | | Top |
|
| Posted by
| Orange
United Kingdom (25 posts) Bio
|
| Date
| Reply #3 on Wed 01 Jan 2003 12:45 PM (UTC) |
| Message
| |
| Posted by
| Kronos
USA (35 posts) Bio
|
| Date
| Reply #4 on Wed 01 Jan 2003 10:48 PM (UTC) |
| Message
| well, its a smaug snippet, and therefore for smaug. SWR has its slight code differences, but the only problem here is that it gives me the 'has no member' error about the
ch->level thing. it crashes because in order to get it to compile i changed level to top_level as you can see in my act_obj.c
so it crashes when i successfully connect the two pieces. it doesnt say anything, it just crashes when i type connect <piece1> <piece2>
so i assume the problem is in my changing ch->level to
ch->top_level
its a smaug snippet im trying to put in SWR, but can anyone help me get it to work?
-Kronos | | Top |
|
| Posted by
| Orange
United Kingdom (25 posts) Bio
|
| Date
| Reply #5 on Wed 01 Jan 2003 11:30 PM (UTC) |
| Message
| | I suggest you find out how to run your mud under gdb, and then you can get the line number its crashing at, and lots of other joyous information. Without that, it's like trying to assemble an aircraft from nuts and bolts in the dark. | | Top |
|
| Posted by
| Meerclar
USA (733 posts) Bio
|
| Date
| Reply #6 on Thu 02 Jan 2003 06:31 AM (UTC) |
| Message
| My personal recommendation is to scrap the whole ACK snipet and just mob programs. I've built and coded on ACK, DoT, Circle and a few other codebases and 99% of the time unless you have an absolute pressing need to convert something from another codebase, its easier to either write it from scratch (I'm guessing thats beyond your capabilities or you'd not be asking for help with a snipet) or find a non-coded solution. Besides, unless that snipet included the ACK rare items code, (or you use the limited intem snipet in another post on this forum) you'll not get the full functionality of the code without heavy mobprog use anyway. Even with the other snipets it's still less headache to write mobprogs to mimic the connection sequence and you can better control who can create the connected items.
Just a suggestion. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #7 on Thu 02 Jan 2003 08:01 AM (UTC) |
| Message
| The type CHAR_DATA has a member "level", however there is no guarantee that "ch" in your code is type CHAR_DATA. You need to check that.
As for why it crashes, it might be more than just the change to top_level. For instance, ch might be NULL. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
25,972 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top