*Virtual object name duplicates an existing object name

As you suggested, I entered issue https://github.com/fluffos/fluffos/issues/659 . I don’t know if it’s a good idea to fix it the way you suggest, but I have tried for weeks to fix it via LPC, and I have failed.

You need ‘call_out(0, (: find_object(name)->virtual_start() :)‘

Thank you for your suggestion, but fluffos gives the error:

                        update /daemons/city_d
## ------- /daemons/city_d.c:379
## Illegal to use local variable in functional.
## call_out(0, (: find_object(path)->virtual_start() :));
##                                                     ^ 
                        update /daemons/city_d
## ------- /daemons/city_d.c:379
## Illegal to use local variable in functional.
## call_out(0, (: find_object(room)->virtual_start() :));
##
                                                     ^ 

Unless I make this a global variable (which is a pretty bad idea since this code is called a lot), I can’t think of a way to get around this problem.

call_out(0, (: $1->virtual_start() :), room)

this would work, right?

Thank you for your excellent suggestion. It doesn’t work either.
room->set_coordinates(x,y,z);
room->set_town(file);
add_exits(room,file,x,y,z);
room->virtual_setup(x,y,z);
//room->virtual_start();
call_out(0, (: $1->virtual_start() :), room);

*Bad argument 1 to call_out()
Expected: string or function Got: 0.
Trace written to /log/runtime
An error has occurred. Please report the context in which you
received this message using ‘note bug’.
[errors] (Crius) Error logged to /log/runtime
[errors] *Bad argument 1 to call_out() *Expected: string or function Got: 0.
[errors] /daemons/city_d at line 379

I figured out why it wasn’t working pretty quickly. The correct syntax is:
call_out((: $1->virtual_start() :), 0, room);

When I do this, the room is broken because virtual_start() doesn’t seem to be called.

goto /domains/city/city_server/7/6/0
DEBUG object=>/cmds/wiz/goto<=
DEBUG file  =>/cmds/wiz/goto.c<=
DEBUG value =>"/cmds/wiz/goto.c main return value: 6
MOVE_OK 1 MOVE_NO_DEST 10 MOVE_NOT_RELEASED 3 MOVE_NOT_ALLOWED 7 prev /std/bit_bucket"<=
Goto: Error in movement.
The room is not being loaded now.
                        @ load_object("/domains/city/city_server/7/6/0")
/domains/city/city_server/7/6/0
goto /domains/city/city_server/7/6/0
DEBUG object=>/cmds/wiz/goto<=
DEBUG file  =>/cmds/wiz/goto.c<=
DEBUG value =>"/cmds/wiz/goto.c main return value: 6
MOVE_OK 1 MOVE_NO_DEST 10 MOVE_NOT_RELEASED 3 MOVE_NOT_ALLOWED 7 prev /std/bit_bucket"<=
Goto: Error in movement.

In the room->virtual_start(); version,
even though I see the error the first time, the room can be travelled to the second time and so on. So, this is worse. :frowning:

this is essentially the same thing as if driver issues the apply using the new patch. So this issue still need to be resolved even if driver is fixed.

You need to look at the error log to see what errors are showing up , in order to fix it.

Using the call_out seems to cause the virtual_start() to not be called. My best guess is $1 isn’t working.
I don’t know what $1 does, but I see no signs of virtual_start() being called on that room. No error message either.
I know when I do room->virtual_start(); this works (every time except the first time). It seems the first time, find_object( “/domains/city/city_server/7/6/0”); is returning 0, and load_object("/domains/city/city_server/7/6/0"); called immediately after find_object() is saying duplicate object.
The root of the problem seems to be find_object() returning 0, when load_object() finds the object.

it is called, but probably not able to “write()” will not goto you, because it is not executed during your command

what you need to look at is that why “goto” is failing after the object was loaded. It is going to be an differ t but related issue that will be there even if you have apply from drivers

As stated in *Virtual object name duplicates an existing object name , the symptoms with call_out((: $1->virtual_start() :), 0, room); are identical to if virtual_start() is not being called on the room. The room isn’t being created, and the size of the room is 0x0x0 (which is what goto error 6 means - no room in destination.)

ed /daemons/city_d.c
Editing: //daemons/city_d.c
:379
call_out((: $1->virtual_start() :), 0, room);
:c
room->virtual_start();
.
:x
"/daemons/city_d.c" 390 lines 11332 bytes
Exit from ed.
You - "/std/bit_bucket">update /daemons/city_d
/daemons/city_d.c: Updated and loaded.
You - "/std/bit_bucket">dest /domains/city/city_server/7/6/0
No such object.
You - "/std/bit_bucket">goto /domains/city/city_server/7/6/0
DEBUG object=>/domains/city/rooms/city/cityroom8#1003<=
DEBUG file  =>/std/virtual_room.c<=
DEBUG value =>"clonep is true!"<=
DEBUG object=>/daemons/city_d<=
DEBUG file  =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1003<=
Found data file in /obj/race//shapes.
Found data file in /obj/race//pc.
Found data file in /domains/city/livings/city/jenna.brain.
Found data file in /obj/items/clothing.
A woman with a long nose ( Jenna ) wears a white cotton dress.
Found data file in /obj/items/clothing.
A woman with a long nose ( Jenna ) wears a wool cloak.
Found data file in /obj/items/clothing.
A woman with a long nose ( Jenna ) wears a leather sandal.
Found data file in /obj/items/clothing.
A woman with a long nose ( Jenna ) wears a leather sandal.
Found data file in /obj/items/clothing.
A woman with a long nose ( Jenna ) wears a leather belt.
Found data file in /obj/items/containers.
A woman with a long nose ( Jenna ) fastens a leather moneybag to a leather
belt.
Found data file in /obj/items/containers.
A woman with a long nose ( Jenna ) wears a canvas backpack.
Found data file in /obj/items/containers.
A woman with a long nose ( Jenna ) fastens a short leather sheath to a leather
belt.
Found data file in /obj/items/weapons/pierce.
A woman with a long nose ( Jenna ) retires her iron stiletto to her short
leather sheath.
Found data file in /domains/city/livings/city/jenna.liv.
Found data file in /domains/city/livings/city/jenna.liv.
DEBUG object=>/domains/city/rooms/city/cityroom8#1003<=
DEBUG file  =>/domains/city/rooms/city/cityroom8.c<=
DEBUG value =>"tent load"<=
DEBUG object=>/domains/city/rooms/city/cityroom8#1021<=
DEBUG file  =>/std/virtual_room.c<=
DEBUG value =>"clonep is true!"<=
DEBUG object=>/daemons/city_d<=
DEBUG file  =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1021<=
Found data file in /obj/race//shapes.
Found data file in /obj/race//pc.
Found data file in /domains/city/livings/city/jenna.brain.
Duplicate copy of unique object.
Found data file in /domains/city/livings/city/jenna.liv.
Found data file in /domains/city/livings/city/jenna.liv.
DEBUG object=>/domains/city/rooms/city/cityroom8#1021<=
DEBUG file  =>/domains/city/rooms/city/cityroom8.c<=
DEBUG value =>"tent load"<=
DEBUG object=>/domains/city/rooms/city/cityroom8#1030<=
DEBUG file  =>/std/virtual_room.c<=
DEBUG value =>"clonep is true!"<=
DEBUG object=>/daemons/city_d<=
DEBUG file  =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1030<=
Found data file in /obj/race//shapes.
Found data file in /obj/race//pc.
Found data file in /domains/city/livings/city/jenna.brain.
Duplicate copy of unique object.
Found data file in /domains/city/livings/city/jenna.liv.
Found data file in /domains/city/livings/city/jenna.liv.
DEBUG object=>/domains/city/rooms/city/cityroom8#1030<=
DEBUG file  =>/domains/city/rooms/city/cityroom8.c<=
DEBUG value =>"tent load"<=
DEBUG object=>/domains/city/rooms/city/cityroom8#1039<=
DEBUG file  =>/std/virtual_room.c<=
DEBUG value =>"clonep is true!"<=
DEBUG object=>/daemons/city_d<=
DEBUG file  =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1039<=
Found data file in /obj/race//shapes.
Found data file in /obj/race//pc.
Found data file in /domains/city/livings/city/jenna.brain.
Duplicate copy of unique object.
Found data file in /domains/city/livings/city/jenna.liv.
Found data file in /domains/city/livings/city/jenna.liv.
DEBUG object=>/domains/city/rooms/city/cityroom8#1039<=
DEBUG file  =>/domains/city/rooms/city/cityroom8.c<=
DEBUG value =>"tent load"<=
DEBUG object=>/daemons/city_d<=
DEBUG file  =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1039<=
DEBUG object=>/secure/master<=
DEBUG file  =>/secure/master.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1039<=
DEBUG object=>/secure/master<=
DEBUG file  =>/secure/master.c<=
DEBUG value =>"virtual_start is successful."<=
DEBUG object=>/secure/master<=
DEBUG file  =>/secure/master.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1039<=
DEBUG object=>/daemons/city_d<=
DEBUG file  =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1030<=
DEBUG object=>/secure/master<=
DEBUG file  =>/secure/master.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1030<=
DEBUG object=>/secure/master<=
DEBUG file  =>/secure/master.c<=
DEBUG value =>"virtual_start is successful."<=
DEBUG object=>/secure/master<=
DEBUG file  =>/secure/master.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#1030<=
*Virtual object name duplicates an existing object name.
Trace written to /log/runtime
An error has occurred.  Please report the context in which you
received this message using 'note bug'.
[errors] (Crius) Error logged to /log/runtime
[errors] *Virtual object name duplicates an existing object name.
[errors] /secure/simul_efun (/secure/simul_efun/overrides.c) at line 256

> goto /domains/city/city_server/7/6/0
DEBUG object=>/secure/daemons/user_d<=
DEBUG file  =>/secure/daemons/user_d.c<=
DEBUG value =>"/secure/daemons/user_d 186 s ''"<=
DEBUG object=>/secure/daemons/user_d<=
DEBUG file  =>/secure/daemons/user_d.c<=
DEBUG value =>".o"<=
DEBUG object=>/secure/daemons/user_d<=
DEBUG file  =>/secure/daemons/user_d.c<=
DEBUG value =>"/secure/daemons/user_d 186 s ''"<=
DEBUG object=>/secure/daemons/user_d<=
DEBUG file  =>/secure/daemons/user_d.c<=
DEBUG value =>".o"<=
DEBUG object=>/cmds/wiz/goto<=
DEBUG file  =>/cmds/wiz/goto.c<=
DEBUG value =>"/cmds/wiz/goto.c main return value 1
MOVE_OK 1 MOVE_NO_DEST 10 MOVE_NOT_RELEASED 3 MOVE_NOT_ALLOWED 7 prev /std/bit_bucket"<=
[Name:city lore Difficulty:1 skill:1030 Result: 57
[Name:city lore Difficulty:1 skill:1030 Result: 10


[/domains/city/city_server/7/6/0]  Town: city|city
Coords: [7,6,0]  Ceiling: None.  Area: 400 m^2.  
The cityroom

Obvious exits: south, north, east, southeast, northeast, west, southwest, and
northwest
It is well lit here.
------------------------------------------------------------------
This is the southeast corner of a large flat area, filled with many colorful
tents.  Very few people wander through the different merchants looking at the
objects for sale.  Some of the tents are closed and tied for the evening, while
others remain open, evident by the hanging lanterns.  A few permanent buildings
can be seen around the edges of the cityroom and roads can be seen to the south
and east.  
This area is very large.  
------------------------------------------------------------------
0 is close by to the northeast.
A tent is close by to the west.
==================================================================
You - "/domains/city/city_server/7/6/0">

IE: room->virtual_start(); works AFTER the first error. The rooms works fine, although one of the tents is 0.

ok… now you are doing an direct “goto” instead of load_object then goto , yeah doing that wouldn’t work , since call_out only execute after the goto.

You just demonstrated that this couldn’t be solved perfectly in LPC, so the new apply is coming right up :slight_smile: today.

it is now included in the latest release, check it out!

Thank you. I sent a message to my boss, but this may take a while.

My boss has updated the fluffos driver to fluffos v2019.2020082501 .
The rooms aren’t being created if I comment out virtual_start() from city_d.
however
if I call virtual_start() from city_d, I get the virtual-object-name-duplicates-an-existing-object-name error the first time, and the room works afterwards.
This is an identical problem to before https://github.com/fluffos/fluffos/issues/659 was patched in.

I have altered the city_d call from
room->virtual_start();
to
call_out((: $1->virtual_start() :), 0, room);
and can confirm that virtual_start() is no longer being called - no tents are attempting to load which is done by virtual_start();
whereas, if I have in city_d:
room->virtual_start();
I can easily see virtual_start() being called properly, and the tents attempting to load.

Please create a virtual_start() in your virtual rooms on your test mud, and confirm that your driver code is calling virtual_start(). I can’t see any signs the updated driver is calling this function. It may be my mistake, it may be the driver’s mistake, but I have tried various ways to detect virtual_start() being called by the driver, and each time I’m getting a “No, virtual_start() isn’t being called.”.
I’m assuming the driver is trying to execute the virtual_start() of the object following the inheritance rules, right? We are inheriting the base object and adding in the virtual_start() for the tent creation in the room - and the base object does not have tent creation in it…

There is already tests in the testsuite to verify that virtual object’s virtual_start() is being called by the driver. Don’t know why that didn’t work you. You don’t need to call it manually in your cityd again. If you want to verify , set an flag in the object and in virtual_start() set that flag to 1 and see afterwards.

Like I said , and debug macro is not going to print anything since the execution is not under an player.

There is another solution to your problem. Instead of having the tent move to the object on create , you can simply construct the object during create() and call move(this_object()) .

My apologies for insisting that virtual_start() is not being called.
My evidence is I am in “/std/bit_bucket”.
1 // /domains/city/rooms/city/cityroom8.c
8 inherit VIRTUAL_ROOM;
9
10 #define DEBUGGER “crius”
11
12 protected void virtual_create(){
34
35 NPC_D->create_npc(NPCS+“jenna.liv”,this());
36 DEBUG(“tent load”);
37 load_object("/domains/city/rooms/city/tent21")->move(this());
38 load_object("/domains/city/rooms/city/tent22")->move(this());
39 load_object("/domains/city/rooms/city/tent23")->move(this());
40 }

In /std/base_room.c
// First function called after create() by the driver…
// This gets called by virtual rooms ONLY.
void virtual_start() {
// Don’t process the blueprints.
if (!clonep())
return;

this()->virtual_create();

// If its a virtual room, we can’t load the doors until we
// do a virtual_create() and thus know the file_name().
DOOR_D->load_room_doors(file_name(this()));
}

In short, once the driver calls virtual_start(), this base_room triggers a call to virtual_create() which causes /domains/city/rooms/city/cityroom8.c to execute virtual_create(). This triggers creating the NPC Jenna, which I would see since I’m in the bit_bucket. Since I don’t see Jenna created, I know virtual_create() isn’t being called, which causes me to suspect virtual_start() isn’t being called. The goto also fails with a 6 (no room) which means the room wasn’t being created properly - which includes setting its size.

You - “/std/bit_bucket”>dest /domains/banzar/city_server/7/6/0
You dest the thing.
DEBUG object=>/cmds/wiz/dest<=
DEBUG file =>/cmds/wiz/dest.c<=
DEBUG value =>"/domains/city/city_server/7/6/0"<=
Restored to previous location.
You - “/std/bit_bucket”>goto /domains/city/city_server/7/6/0
DEBUG object=>/domains/city/rooms/city/cityroom8#845<=
DEBUG file =>/std/virtual_room.c<=
DEBUG value =>“clonep is true!”<=
DEBUG object=>/daemons/city_d<=
DEBUG file =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#845<=
DEBUG object=>/daemons/city_d<=
DEBUG file =>/daemons/city_d.c<=
DEBUG value =>/domains/city/rooms/city/cityroom8#845<=
You disappear in a puff of smoke.
DEBUG object=>/cmds/wiz/goto<=
DEBUG file =>/cmds/wiz/goto.c<=
DEBUG value =>"/cmds/wiz/goto.c main return value 6
MOVE_OK 1 MOVE_NO_DEST 10 MOVE_NOT_RELEASED 3 MOVE_NOT_ALLOWED 7 prev /std/bit_bucket"<=
Goto: Error in movement.

please create an test program with an minimal structure before dipping into this myriad of calls, anything could be happening and you need to verify you understand how basic stuff works before understanding what is going on.

Check error logs, and the virtual_start() call may have triggered errors so it didn’t fully execute , that would appear as “not called” , but it will show up in the error logs