Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
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
LOP 1.45
Author: Remcon
Submitted by: Remcon
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
Users Online
CommonCrawl, Majestic-12, Yahoo!

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » set_supermob
Forum Rules | Mark all | Recent Posts

set_supermob
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Oct 6, 2011, 12:15 am
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

In set supermob I read:
   supermob_obj = obj;
   for( in_obj = obj; in_obj->in_obj; in_obj = in_obj->in_obj )
      ;

   if( in_obj->carried_by )
      room = in_obj->carried_by->in_room;
   else
      room = obj->in_room;


Isn't better: room = in_obj->in_room ?

byea ;)
       
Post is unread #2 Oct 6, 2011, 2:14 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

No, it only wants to use in_obj in the event the object is being carried by someone. Otherwise using obj is fine, because the function is ultimately looking for the room they're all in.
       
Post is unread #3 Oct 6, 2011, 2:32 am
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

Ok, but if I had a mud prog on a sword that is inside a container on the floor, and I trigg the sword prog?

If set_supermob use "room = obj->in_room", I had "room = NULL".
Instead with "room = in_obj->in_room", room is where sword is located (and where prog trigs).

Also if room is null mpecho, mea, mer, etc doesn't work I think.

Thank you
mat
       
Post is unread #4 Oct 6, 2011, 12:27 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

you could add something like this after all that:

else
{
    room = obj->in_room;
    if( room == NULL ) // Or something similar
        room = in_obj->in_room;
}

This should stop the NULL you speak of, assuming it triggers inside an object not carried, and not sitting directly in the room.

Then again, I could be completely wrong. :P
       
Post is unread #5 Oct 6, 2011, 2:18 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

You shouldn't be able to trigger the prog on an object inside another object.
       
Post is unread #6 Oct 7, 2011, 1:42 am   Last edited Oct 7, 2011, 1:56 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

Aurin said:

you could add something like this after all that:
else
{
    room = obj->in_room;
    if( room == NULL ) // Or something similar
        room = in_obj->in_room;
}

This should stop the NULL you speak of, assuming it triggers inside an object not carried, and not sitting directly in the room.
Then again, I could be completely wrong. :P


Ok but before - in for stance - we have: in_obj = obj;
so put directly room = in_obj->in_room is good enough I think wihout any other exception.
This because if "in_obj" isn't inside another another object in_obj is simply obj.
Otherwise in_obj->in_room is where really the progs triggs.
       
Post is unread #7 Oct 7, 2011, 1:52 am   Last edited Oct 7, 2011, 1:56 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

Kayle said:

You shouldn't be able to trigger the prog on an object inside another object.


That's is true.
Probably I prefear use in_obj->in_room because in my smaug I had added programs like "pre_get", "pre_put", etc that triggs BEFORE there is the classical "obj_from_obj( obj, container )", so - for example - if a player try to take a object inside a container and the obj (or container) has a pre_get prog, the mud progs can abort the action.

Example:
take sword rock
You try to extract sword from rock, but you are not strong enought.

In any case, I think is more logic use in_obj->in_room because the action room where the progs start is in_obj->in_room and sometimes not really obj->in_room.
       
Post is unread #8 Oct 7, 2011, 10:13 am
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

But, wouldn't you then get a null for any object that's in a room? Since you're changing obj->in_room to in_obj->in_room, you no longer have a way to represent an object just sitting in the room that triggers a prog. Only if it's in an object--or being carried--would it trigger.
       
Post is unread #9 Oct 7, 2011, 2:58 pm   Last edited Oct 7, 2011, 3:01 pm by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

Thank you for reply.

Excuse me, you say: "you no longer have a way to represent an object just sitting in the room that triggers a prog. Only if it's in an object--or being carried--would it trigger".

Probably I had lost the point but if the obj just sitting in a room... obj->in_room is NOT null, so in_obj->in_room is the same.
Can you report me an example about what you say?
       
Post is unread #10 Oct 7, 2011, 3:37 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

Okay, maybe I'll ask it like this, as I'm a newbie coder:
Does obj->in_room == in_obj->in_room?

If not, what's the difference?

From my understanding, in_obj will look for an object inside another object. obj will look for object in the room. If you have an object sitting in the room with a get trigger, and it is not inside another object, how would in_obj->in_room react to an object that is not inside another object? Would it not react at all? If it doesn't react at all, then room evaluates to NULL.

Thus, my question on the previous post: But, wouldn't you then get a null for any object that's in a room? (Addendum: ..in a room that has a program attached to it?)
       
Post is unread #11 Oct 7, 2011, 9:33 pm   Last edited Oct 7, 2011, 9:41 pm by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

Ok

Does obj->in_room == in_obj->in_room?


Yes, it is the same if "obj" sitting in the room.
Instead change if the "obj" is inside another object that sitting in the room.
Looking the for cicle we had:

for( in_obj = obj; in_obj->in_obj; in_obj = in_obj->in_obj )
;


1) obj lies directly in room?
in_obj->in_obj; check fails, so: obj->in_room == in_obj->in_room and point to the room.
This because in_obj = obj;.

2) obj is directly carried_by?
in_obj->in_obj; check again fails, so: obj->in_room is NULL and in_obj->in_room is NULL.
This because in_obj = obj; ...but in_obj->carried_by is TRUE and also obj->carryed_by is TRUE).

3) obj stay inside another object that lies in room?
in_obj->in_obj; ckeck is TRUE, and in_obj = in_obj->in_obj change the assign of in_obj pointer that became different from obj.
So obj->in_room is NULL but in_obj->in_room point to the room.

4) obj is inside another object that's carryed_by?
in_obj->in_obj; check is TRUE and in_obj = in_obj->in_obj change the assign of in_obj pointer that became different from obj.
So: obj->in_room is NULL, also in_obj->in_room is NULL, obj->carried_by is NULL, but in_obj->carried_by is TRUE and in_obj->carried_by->in_room point to the room.


In conclusion, using my mod, the set_supermob function change only in case (3).
       
Pages:<< prev 1 next >>