Reload itemdesc.cfg?

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.

Moderator: POL Developer

Post Reply
Jester
Neophyte Poster
Posts: 36
Joined: Mon Jul 07, 2008 2:33 pm

Reload itemdesc.cfg?

Post by Jester »

Hey hey everyone.

Could use a bit of advice, when I unload all scripts/cfg files and so on on my server (so I do not need to restart the shard after I changed stuff) the itemdescs are not reloaded for all scripts. The AI script for merchant.src do not reload all itemdescs, only the basic one in pol/config. I got alot of others in their own packages and these are not reloaded. After a restart it all works great, but how can I get it to reload them all without a restart?

// Jester
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Reload itemdesc.cfg?

Post by *Edwards »

Hi Jester,

You can use UnloadConfigFile( rootfilename ).

Exemple 1:
A config file situated in alchemy package:

Code: Select all

UnloadConfigFile( '':alchemy:alchemypotion'' );
Exemple 2:
Reload all itemdesc from all packages:

Code: Select all

UnloadConfigFile( '':*:itemdesc'' );
Just add the code to a command file or something!

Goodluck ;)

Note:
I never tested that one and couldn't say if it would unload all config files of every packages:

Code: Select all

UnloadConfigFile( '':*:*'' );
My logic would say yes. Does anyone has the answer?
Jester
Neophyte Poster
Posts: 36
Joined: Mon Jul 07, 2008 2:33 pm

Re: Reload itemdesc.cfg?

Post by Jester »

*Edwards wrote:Hi Jester,

You can use UnloadConfigFile( rootfilename ).

Exemple 1:
A config file situated in alchemy package:

Code: Select all

UnloadConfigFile( '':alchemy:alchemypotion'' );
Exemple 2:
Reload all itemdesc from all packages:

Code: Select all

UnloadConfigFile( '':*:itemdesc'' );
Just add the code to a command file or something!

Goodluck ;)

Note:
I never tested that one and couldn't say if it would unload all config files of every packages:

Code: Select all

UnloadConfigFile( '':*:*'' );
My logic would say yes. Does anyone has the answer?

I can unload my cfgs allready, I need to reload them though. AI scripts can't seem to reload them after they been unloaded on their own, only a restart makes them load them again.
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Reload itemdesc.cfg?

Post by Pierce »

Imho you can't unload the itemdesc.cfg. So if you add an entry you always need
to restart the server. At least it never worked for me ;)
AI scripts can't seem to reload them after they been unloaded on their own, only a restart makes them load them again.
AI scripts reload, but you have to start the script on the npc again. The server knows the new script but the alive npc runs on the old one. Or you just create a new npc of that type cause the newly created npc will run on the new script.

You need to write a script that uses the following command on all npcs that are running the script you changed:

RestartScript( npc );
Last edited by Pierce on Wed Oct 29, 2008 6:49 am, edited 1 time in total.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Reload itemdesc.cfg?

Post by *Edwards »

Code: Select all

UnloadConfigFile(":*:npcdesc");
or

Code: Select all

UnloadConfigFile("::npcdesc");

To Pierce: Aha completely forgot it. Nver worked for me too hehe. But anyways he got my point with UnloadCFG
Jester
Neophyte Poster
Posts: 36
Joined: Mon Jul 07, 2008 2:33 pm

Re: Reload itemdesc.cfg?

Post by Jester »

Pierce wrote:Imho you can't unload the itemdesc.cfg. So if you add an entry you always need
to restart the server. At least it never worked for me ;)
AI scripts can't seem to reload them after they been unloaded on their own, only a restart makes them load them again.
AI scripts reload, but you have to start the script on the npc again. The server knows the new script but the alive npc runs on the old one. Or you just create a new npc of that type cause the newly created npc will run on the new script.

You need to write a script that uses the following command on all npcs that are running the script you changed:

RestartScript( npc );
The problem is that after I unloaded all my cfgs, it can only find elements in the itemdesc.cfg in config folder. Trying to sell any items that are listen in any other itemdesc.cfg returns that it cannot find the element. This is what gives me problem in the merchant.src script:

Code: Select all

        var itemdesc := ReadConfigFile("::itemdesc");
	var elem := FindConfigElem(itemdesc, tgt.objtype);

	if (!elem)
		PrintTextAbovePrivate( me, "no elem", you);
		return;
	endif
I added the PrintAbove to see where it went wrong, and now when I try to sell item's listed in another itemdesc then config/itemdesc.cfg it sais "no elem". So either it only finds that itemdesc when var itemdesc is defined, or the error is when var elem is defined, what you guys think is the best way to solve this?

If I restart the shard it is solved, but I want to be able to solve this without restart
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Reload itemdesc.cfg?

Post by Pierce »

If you want to read all itemdesc.cfg it has to be:
var itemdesc := ReadConfigFile(":*:itemdesc");

But i don't think that this will solve your problem with new added items without restart.
Perhaps it's worth a try :D
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Reload itemdesc.cfg?

Post by *Edwards »

Definitively not possible to unload config itemdesc :withstupid:
Jester
Neophyte Poster
Posts: 36
Joined: Mon Jul 07, 2008 2:33 pm

Re: Reload itemdesc.cfg?

Post by Jester »

Pierce wrote:If you want to read all itemdesc.cfg it has to be:
var itemdesc := ReadConfigFile(":*:itemdesc");

But i don't think that this will solve your problem with new added items without restart.
Perhaps it's worth a try :D
Well, my problem isn't adding items, it's more like whenever I use my unload cmd (I set it to unload everything) people cannot sell items. I want to be able to fix that without restarting the shard.


I tried making that change to my merchant.src script and it worked great, thanks for the help :)
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Reload itemdesc.cfg?

Post by *Edwards »

Here goes the definition:

You can run your shard and create items in your itemsdesc ( obviously ) while your shard is running. But. BUT! that new item cannot be created before your restard the server. You can use unload your cfgs hundread of times or cry a river it won't work if you do not restart your server :). Maybe I'm missing your point Jester. Anyway it's my advice : restart your shard :shame: .
Jester
Neophyte Poster
Posts: 36
Joined: Mon Jul 07, 2008 2:33 pm

Re: Reload itemdesc.cfg?

Post by Jester »

*Edwards wrote:Here goes the definition:

You can run your shard and create items in your itemsdesc ( obviously ) while your shard is running. But. BUT! that new item cannot be created before your restard the server. You can use unload your cfgs hundread of times or cry a river it won't work if you do not restart your server :). Maybe I'm missing your point Jester. Anyway it's my advice : restart your shard :shame: .

Yeah you are missing my point, the point was that when a reloading my merchant script it would not find all the itemdesc files if I did not restart. So you could not sell all files to my NPCs, this was fixed after I took Pierce's suggestion with simply adding a "*". Totally forgotten about that tbh ;)
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Reload itemdesc.cfg?

Post by *Edwards »

It's not like I didn't mention it in my first reply... But if you prefer Pierce suggestion alright, gooluckl ¬_¬ ...
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Reload itemdesc.cfg?

Post by Yukiko »

Jester it has been my experience that trying to unload any itemdesc files and reload them whilst the server is running causes problems. I believe the reason for this is because the items are instantiated in the world and unloading the itemdesc files, if it were possible would cause all created items to suddenly be removed from all of the "world". This would include all storage areas and containers etc. as well as those items that existed "out in the open". Then reloading them would require the server to repopulate the world. Basically it would be jut like a restart except for starting scripts again. So I think either the developers never thought about making it possible, they figured it would take the same amount of time to do that versus restart so they didn't implement it or it wouldn't work properly to do it for some reason.

BTW I have had the same issue with unloading and reloading NPCDesc files too but maybe that was because I forgot to do a global restart of their AI scripts.
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Reload itemdesc.cfg?

Post by Pierce »

We all didn't understand what Jester wanted, including me.
We think he wanted to unload the itemdesc.cfg.
That's not the case if i understood it now the right way.
He simple has the problem, that after changing/unloading his merchant script, the
script only reads the itemdesc.cfg in the main config/ folder, which leads to the
fact, that his players can only buy items listed in this file.
I hope i get it right now ;)
The important thing is: It works now for him nevertheless what we all thought :D
Jester
Neophyte Poster
Posts: 36
Joined: Mon Jul 07, 2008 2:33 pm

Re: Reload itemdesc.cfg?

Post by Jester »

Pierce wrote:We all didn't understand what Jester wanted, including me.
We think he wanted to unload the itemdesc.cfg.
That's not the case if i understood it now the right way.
He simple has the problem, that after changing/unloading his merchant script, the
script only reads the itemdesc.cfg in the main config/ folder, which leads to the
fact, that his players can only buy items listed in this file.
I hope i get it right now ;)
The important thing is: It works now for him nevertheless what we all thought :D
Exactly, I dunno what caused it, my "unload everything" cmd unloads most scripts include cfgs. But thanks for the help ;)
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Reload itemdesc.cfg?

Post by Yukiko »

Okies.

I thought I understood it too.
*grins*
Guess not.

I usually have trouble when adding things to the mrcspawn.cfg file. Merchants take forever to get the new items into inventory. I finally wrote a script to wipe inventories and restock them just to get new items in.
Post Reply