*Virtual object name duplicates an existing object name

BTW: it seems we could easily add this “virtual_start” apply in Fluffos too, this way you wouldn’t have to simulate this in LPC ,which would eliminate this weird issue of recursive loading object , since driver will take care calling it after the object is fully constructed

if so you can file a issue on github.com/fluffos/fluffos and I can easily add this.

326 //////////////////////////////////////////////////////////////////////
327 //:FUNCTION get_city_room
328 //////////////////////////////////////////////////////////////////////
329 //object get_city_room(string file, int x, int y, int z);
330 //
331 //Returns the object for a virtual room at the specific location on
332 //the given ‘file’ virtual city map.
333 //////////////////////////////////////////////////////////////////////
334 object get_city_room(string file, int x, int y, int z) {
335 mixed roomfile;
336 string path;
337 object room;
338 //eagled added
339 string map_name=(explode(file,"/")[<1]);
340 if(z) { file = file+"/"+map_name+"."+z; }
341 roomfile=get_room_designation(file,x,y,0);
342 if (!roomfile) {
343 warning(“city_d’get_city_room: Unable to find room: “+file+”:”+x+","+y+","+z);
344 return 0;
345 }
346 path = rooms[file][roomfile];
347 if (path)
348 //if(room=find_object(path)) //Crius: I know this is an assignment.
349 //return room;
350 room=new(path/,"/domains/"+file+"/city_server/"+x+"/"+y+"/"+z/);
351 DEBUG(room);
352 if (!room) {
353 DEBUG(room);
354 room = new("/domains/"+file+"/default_city_room");
355 if (!room) {
356 DEBUG(room);
357 room = new(DEFAULT_ROOM);
358 if ((!path)||(path="")){
359 DEBUG(room);
360 room->set_brief(roomfile);
361 room->set_long(“You are in “+roomfile+”.\n”);
362 } else {
363 room->set_long(“You are in “+explode(path, “/”)[<1]+”. “);
364 room->set_brief(”/domains/”+file+"/"+
365 explode(path,"/")[<1]);
366 }
367 }
368 }
369 if (!room->is_virtual_room()) {
370 destruct(room);
371 error(“City daemon virtual rooms must inherit VIRTUAL_ROOM.”);
372 return 0;
373 }
374 room->set_coordinates(x,y,z);
375 room->set_town(file);
376 add_exits(room,file,x,y,z);
377 room->virtual_setup(x,y,z);
378 room->virtual_start();
379 DEBUG(room);
380 return room;
381 }
This is the current get_city_room which does indeed call new(). I’ll give your call_out(0, (: xx->virtual_start() :) ); a try, though I’m reasonably certain I tried that before, and got the same error anyways.

update /daemons/city_d

------- /daemons/city_d.c:379

Illegal to use local variable in functional.

call_out(0, (: room->virtual_start() :slight_smile: );

^

I recall trying this before. I remember it didn’t work.
I also remember I needed to change it to call_other(), but even after a 5 second delay, it still didn’t work.
I wrote it as call_other(room, “virtual_start” , 0); and the error I get is:
Tue Aug 25 01:28:13 2020
*Virtual object name duplicates an existing object name.
Object: /secure/simul_efun (/secure/simul_efun/overrides.c) at line 256

#0: ‘’ at /secure/spirit#819 (/) at /(fake):0
#1: ‘dispatch_modal_input’ at /secure/spirit#819 (/secure/spirit/inputsys.c) at
line 332
#2: ‘’ at /trans/obj/wish#838 (/) at /(fake):0
#3: ‘shell_input’ at /trans/obj/wish#838 (/obj/secure/shell.c) at line 170
#4: ‘execute_command’ at /trans/obj/wish#838 at line 239
#5: ‘call_main’ at /cmds/wiz/goto (/obj/secure/cmd.c) at line 33
#6: ‘main’ at /cmds/wiz/goto at line 47
#7: ‘load_object’ at /secure/simul_efun (/secure/simul_efun/overrides.c) at
line 256
#8: ‘compile_object’ at /secure/master at line 53
#9: ‘create_virtual’ at /domains/city/city_server (/std/base_city_server.c)
at line 20
#10: ‘get_city_room’ at /daemons/city_d at line 379
#11: ‘virtual_start’ at /domains/city/rooms/city/cityroom8#901
(/std/base_room.c) at line 127
#12: ‘virtual_create’ at /domains/city/rooms/city/cityroom8#901 at line 37
#13: ‘load_object’ at /secure/simul_efun (/secure/simul_efun/overrides.c) at
line 256
#14: ‘create’ at /domains/city/rooms/city/tent21 at line 17
#15: ‘set_tent_location’ at /domains/city/rooms/city/tent21
(/obj/base/misc/tent.c) at line 30
#16: ‘load_object’ at /secure/simul_efun (/secure/simul_efun/overrides.c) at
line 256
#17: ‘compile_object’ at /secure/master at line 53
#18: ‘create_virtual’ at /domains/city/city_server (/std/base_city_server.c)
at line 20
#19: ‘get_city_room’ at /daemons/city_d at line 379
#20: ‘virtual_start’ at /domains/city/rooms/city/cityroom8#919
(/std/base_room.c) at line 127
#21: ‘virtual_create’ at /domains/city/rooms/city/cityroom8#919 at line 38
#22: ‘load_object’ at /secure/simul_efun (/secure/simul_efun/overrides.c) at
line 256
#23: ‘create’ at /domains/city/rooms/city/tent22 at line 16
#24: ‘set_tent_location’ at /domains/city/rooms/city/tent22
(/obj/base/misc/tent.c) at line 30
#25: ‘load_object’ at /secure/simul_efun (/secure/simul_efun/overrides.c) at
line 256

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…