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
➜ Toggling item prog
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Edgeofforever
(25 posts) Bio
|
| Date
| Tue 02 Nov 2004 12:32 PM (UTC) |
| Message
| Heres what I want to do: Have a representational value of an item set to 0 when the item is created. Then, when you examen the item, it does some echo and sets the value to 1. Then, if it is examned again, it does some different echo and sets the item to 0 again. I tried this:
if objval5(0)
<echo 1>
mposet 1201 v5 1
else
<echo 2>
mposet 1201 v5 0
endif
I also tried replacing the if statement by:
if objval(5) = 0
if objval5(<vnum>) = 0
if objval5(<keyword>) = 0
All of these are returning an "unknow ifcheck error", but when I went into the code, the ifcheck for "objval5" is there and seems to do what I would want it to. This has also somehow turned my object into a noteboard that you can wear on your back.
Any help on this problem would be appriciated. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 03 Nov 2004 04:22 AM (UTC) |
| Message
| | Can you post your exact mob/object prog, and state what kind of program you are running (eg. look_prog)? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Edgeofforever
(25 posts) Bio
|
| Date
| Reply #2 on Fri 05 Nov 2004 08:07 PM (UTC) Amended on Sun 07 Nov 2004 12:59 AM (UTC) by Nick Gammon
|
| Message
| Well, I fixed this problem by writing two new commands that do what I wanted it to. However, while I was writing the commands, I stumbled across an Idea for a permanent flag, ie the equiptment never is removed, never scraps, doesn't dt etc. Heres my editing of the making a corpse code:
for ( obj = ch->first_carrying; obj; obj = obj_next )
{
obj_next = obj->next_content;
if( IS_OBJ_STAT(obj, ITEM_PERM))
{
if(obj->next_content == NULL)
{
obj_to_room( corpse, ch->in_room );
return;
}
}
else
{
obj_from_char( obj );
if ( IS_OBJ_STAT( obj, ITEM_INVENTORY )
|| IS_OBJ_STAT( obj, ITEM_DEATHROT ) )
extract_obj( obj );
else
obj_to_obj( obj, corpse );
}
}
| | Top |
|
| Posted by
| Edgeofforever
(25 posts) Bio
|
| Date
| Reply #3 on Fri 05 Nov 2004 08:09 PM (UTC) |
| Message
| The problem seems to be that even though the code never hits the
obj_from_char code, my item still dissapears. Any ideas? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sun 07 Nov 2004 01:06 AM (UTC) |
| Message
| Is this the code before you edited it? ...
for ( obj = ch->first_carrying; obj; obj = obj_next )
{
obj_next = obj->next_content;
obj_from_char( obj );
if ( IS_OBJ_STAT( obj, ITEM_INVENTORY )
|| IS_OBJ_STAT( obj, ITEM_DEATHROT ) )
extract_obj( obj );
else
obj_to_obj( obj, corpse );
}
obj_to_room( corpse, ch->in_room );
return;
Your changes seem to make it do something different to what you might expect.
Why not just use continue, like this:
for ( obj = ch->first_carrying; obj; obj = obj_next )
{
obj_next = obj->next_content;
if( IS_OBJ_STAT(obj, ITEM_PERM))
continue;
obj_from_char( obj );
if ( IS_OBJ_STAT( obj, ITEM_INVENTORY )
|| IS_OBJ_STAT( obj, ITEM_DEATHROT ) )
extract_obj( obj );
else
obj_to_obj( obj, corpse );
}
obj_to_room( corpse, ch->in_room );
return;
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Edgeofforever
(25 posts) Bio
|
| Date
| Reply #5 on Sun 07 Nov 2004 07:08 PM (UTC) |
| Message
| | That code makes sense to me, the continue, unfortunately, I tested it and the item dissapears. Instead of remaining on the character or in the corpse, it simply dissapears. Not sure why this is... any ideas? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Sun 07 Nov 2004 08:10 PM (UTC) |
| Message
| | No it isn't clear, unless you maybe put the check *after* obj_from_char. Try running under gdb and seeing what happens after that loop. |
- 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.
20,783 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top