Yukiko
Joined: 02 Feb 2006 Posts: 1094 Location: Southern Central USA
|
Posted: Thu Aug 02, 2007 5:14 pm Post subject: A script to do a mass copy of items from brit to alt brit |
|
|
Our shard is still being decorated and we have yet to start on the alternate britannia realm. It is bare! We do however have the britannia realm fairly well finished, atleast as far as the essentials, doors, lamp posts, street signs etc. I was going to assign the task of decorating alt brit to one of my staff and then it struck me that alot of what she would be doing is a duplicate of what was already done in britannia so I decided to script a command to do a mass copy of certain items that would be the same in both realms. I try to make life as easy as possible for my staff. For the most part there'll be doors and lamp posts in both realms and maybe a few other things depending on the theme for alt brit. Our alt will be a twisted reality kind of theme but as I said there will be common items. Our dungeons are going to remain mapped the same way as well.
So here is that program. It is written to run under a converted POL 0.95 Distro scriptset but most objtype numbers will probably be the same for other versions od scriptsets as the graphic is the objtype number for most items. Pay particular attention to objtype 0x6203 as that is the teleporter item created with the .maketele command. That might be different in other scripsets but I don't know.
I hope this is helpful to someone.
| Code: |
use uo;
use os;
program copytodespair(who)
var things, copieditem;
SendSysMessage(who, "Duplicating items to Despair.", color := 88);
things := ListObjectsInBox(0, 0, -10, 6143, 4095, 70, "britannia");
foreach item in things
sleepms(5);
SendSysMessage(who, "Examining objtype number " + item.objtype + " at " + item.x + ", " + item.y + ", " + item.z + ".", color := 88);
if(item.IsA(POLCLASS_DOOR))
copieditem := CreateItemCopyAtLocation(item.x, item.y, item.z, item, "britannia_alt");
endif
// You can add or remove items in the case list to fit your needs
case(item.objtype)
0xb20: // lamp post lit
0xb21: // lamp post unlit
0xb22: // lamp post lit
0xb23: // lamp post unlit
0xb24: // lamp post lit
0xb25: // lamp post unlit
0x1296: // street sign post
0x1297: // the various street signs
0x1298: // the various street signs
0x1299: // the various street signs
0x129a: // the various street signs
0x129b: // the various street signs
0x129c: // the various street signs
0x129d: // the various street signs
// The next item is the maketele teleporter
0x6203: copieditem := CreateItemCopyAtLocation(item.x, item.y, item.z, item, "britannia_alt");
endcase
// Change the realm destination to alt brit on the teleporters
if(item.objtype == 0x6203)
SetObjProperty(copieditem, "DestRealm", "britannia_alt");
endif
endforeach
SendSysMessage(who, "Done duplicating items to Despair.", color := 66);
endprogram
|
Save it in your test level text command folder as masscopy.src or whatever you like and compile.
I know it isn't much but it's one of those nice timesavers that make things easier. The real muscle work is done by the CreateItemCopyAtLocation function which I didn't realize even existed. It must have been added after POL 0.92 because I have an old dupe item script that I used to use that performed the same function but addressed each item member one at a time. Yeah I know I look stupid for not knowing of this function. Oh well, I also don't know every entry in Roget's Thesaurus either.
Anyway, use it if you need it.
One note about the script I should mention, it is a use once script as it stands because it doesn't check if the item exists at the destination location. So if you run it more than once you will get duplicate items stacked on top of one another. |
|