Reload itemdesc.cfg?
Moderator: POL Developer
Reload itemdesc.cfg?
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
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
Re: Reload itemdesc.cfg?
Hi Jester,
You can use UnloadConfigFile( rootfilename ).
Exemple 1:
A config file situated in alchemy package:
Exemple 2:
Reload all itemdesc from all packages:
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:
My logic would say yes. Does anyone has the answer?
You can use UnloadConfigFile( rootfilename ).
Exemple 1:
A config file situated in alchemy package:
Code: Select all
UnloadConfigFile( '':alchemy:alchemypotion'' );
Reload all itemdesc from all packages:
Code: Select all
UnloadConfigFile( '':*:itemdesc'' );
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( '':*:*'' );
Re: Reload itemdesc.cfg?
*Edwards wrote:Hi Jester,
You can use UnloadConfigFile( rootfilename ).
Exemple 1:
A config file situated in alchemy package:Exemple 2:Code: Select all
UnloadConfigFile( '':alchemy:alchemypotion'' );
Reload all itemdesc from all packages:Just add the code to a command file or something!Code: Select all
UnloadConfigFile( '':*:itemdesc'' );
Goodluck
Note:
I never tested that one and couldn't say if it would unload all config files of every packages:
My logic would say yes. Does anyone has the answer?Code: Select all
UnloadConfigFile( '':*:*'' );
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.
Re: Reload itemdesc.cfg?
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
You need to write a script that uses the following command on all npcs that are running the script you changed:
RestartScript( npc );
to restart the server. At least it never worked for me
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.AI scripts can't seem to reload them after they been unloaded on their own, only a restart makes them load them again.
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.
Re: Reload itemdesc.cfg?
Code: Select all
UnloadConfigFile(":*:npcdesc");
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
Re: Reload itemdesc.cfg?
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: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 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.AI scripts can't seem to reload them after they been unloaded on their own, only a restart makes them load them again.
You need to write a script that uses the following command on all npcs that are running the script you changed:
RestartScript( npc );
Code: Select all
var itemdesc := ReadConfigFile("::itemdesc");
var elem := FindConfigElem(itemdesc, tgt.objtype);
if (!elem)
PrintTextAbovePrivate( me, "no elem", you);
return;
endif
If I restart the shard it is solved, but I want to be able to solve this without restart
Re: Reload itemdesc.cfg?
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
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
Re: Reload itemdesc.cfg?
Definitively not possible to unload config itemdesc
Re: Reload itemdesc.cfg?
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.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
I tried making that change to my merchant.src script and it worked great, thanks for the help
Re: Reload itemdesc.cfg?
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 .
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 .
Re: Reload itemdesc.cfg?
*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 .
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
Re: Reload itemdesc.cfg?
It's not like I didn't mention it in my first reply... But if you prefer Pierce suggestion alright, gooluckl ...
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: Reload itemdesc.cfg?
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.
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.
Re: Reload itemdesc.cfg?
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
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
Re: Reload itemdesc.cfg?
Exactly, I dunno what caused it, my "unload everything" cmd unloads most scripts include cfgs. But thanks for the helpPierce 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
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: Reload itemdesc.cfg?
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.
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.