PenUltima Online

It is currently Sat Aug 30, 2008 6:18 am

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ] 
Author Message
 Post subject: .unloadall
PostPosted: Fri Feb 10, 2006 9:07 am 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
I know there is a way to script it. But... why not a default cmd?

.unloadall would, unload all loaded scripts, refresh unloaded scripts. And unload all loaded cfg files, including packaged cfg files. for faster unloading and development.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 2:57 pm 
Forgive me, but you seem to want a lot of core functions that duplicate easy-to-write script functions. I don't think this type of thing is good.

I also don't like 'default commands' at all; I want to have as much control over what happens with a command as possible.


Top
  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 10:49 am 
Offline

Joined: Sat Feb 04, 2006 10:59 am
Posts: 4
Location: Poland
There already is a builtin textcmd .unloadall which unloads all cached scripts. See: http://poldoc.fem.tu-ilmenau.de/builtintextcmds.php


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 12, 2006 9:55 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 834
Location: Indiana, USA
ALWAYS be sure to RTFM at poldoc and the core-changes.txt please.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 23, 2006 9:23 pm 
Offline

Joined: Sat Feb 04, 2006 9:14 am
Posts: 90
Location: Aman
MuadDib... make the sticky post with RTFM :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 4:17 am 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
I know there's already .unloadall. I'm asking for a better one. Actually the current one doesn't even seem to do the job right for some reason.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 04, 2006 7:25 pm 
.unload / .unloadall never failed for me before? If it's an npc script that fails to unload, make sure to delete and recreate it since the NPC uses the cached version of the script, even after .unloadall.


Top
  
 
 Post subject:
PostPosted: Sat Mar 04, 2006 8:23 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
As I read it, the original request asks for not only scripts to be unloaded but also cfg files - without having to specify them each by name.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 04, 2006 8:56 pm 
Thing is, I don't understand the reason for an "unload all configs" command at all. Unloadall works on all scripts because you could quite possibly update a LOT of scripts all at once - say when you update a single frequently-used Include, and then compile all your scripts.

There is no such equivalent with configs, though; You have to 'manually' change one file to get it to need updating, so why should a command be hard-coded for something that could be scripted for whatever off-the-wall purpose it might ever be needed for; For example, say you go through and edit lots of itemdesc.cfg files; it's trivial to just unload all of those via a quick script.


Top
  
 
 Post subject:
PostPosted: Sat Mar 04, 2006 10:34 pm 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
Well if you update killpcs script you have to restart the server, you aren't going to .kill all 3000 npcs are you?

ANYWAY.
Code:
Use cfgfile;
Use polsys;
Use os;

Program textcmd_mount( Who )

    Var CONFIG_FILES := {
    ":*:animxlate",
    ":*:armrdesc",
    ":*:armrzone",
    ":*:bannedips",
    ":*:boats",
    ":*:bowcraft",
    ":*:circles",
    ":*:cloth",
    ":*:cmds",
    ":*:combat",
    ":*:console",
    ":*:corpses",
    ":*:days",
    ":*:dyeitems",
    ":*:equip",
    ":*:food",
    ":*:golocs",
    ":*:guardedareas",
    ":*:incognito",
    ":*:innlocation",
    ":*:itemdesc",
    ":*:menus",
    ":*:movecost",
    ":*:mrcspawn",
    ":*:multis",
    ":*:names",
    ":*:nlootgroup",
    ":*:npcdesc",
    ":*:RankingList",
    ":*:repsys",
    ":*:servers",
    ":*:servspecopt",
    ":*:sets",
    ":*:skills",
    ":*:songs",
    ":*:speechgroup",
    ":*:spells",
    ":*:starteqp",
    ":*:startloc",
    ":*:teleporters",
    ":*:traveling",
    ":*:use_stuff",
    ":*:watch",
    ":*:wepndesc",
    ":*:xlate",
    ":aspoxitems:itemdesc",
    ":botanik:itemdesc",
    ":botanik:tree",
    ":chests:itemdesc",
    ":chests:lockpicking",
    ":commcrystals:itemdesc",
    ":decorations:itemdesc",
    ":delayfixes:itemdesc",
    ":doors:itemdesc",
    ":doors:door",
    ":dundee:itemdesc",
    ":dundee:dragonspeak",
    ":dundee:codex",
    ":dyteitems:itemdesc",
    ":dyteitems:dyeitems",
    ":guildstone:itemdesc",
    ":lighting:itemdesc",
    ":lockboxes:itemdesc",
    ":omnibind:itemdesc",
    ":omnibind:binding",
    ":races:itemdesc",
    ":runebook:itemdesc",
    ":shilitems:itemdesc",
    ":shilitems:usescriptdesc",
    ":training:itemdesc",
    ":treasuremap:itemdesc",
    ":treasuremap:guardians",
    ":treasuremap:treasure",
    ":ulitems:itemdesc",
    ":traps:itemdesc",
    ":zulugames:itemdesc",
    ":artificier:itemdesc",
    ":artificier:rituals",
    ":earth:shapeshift",
    ":holybook:itemdesc",
    ":necro:itemdesc",
    ":songbook:itemdesc",
    ":zulumagic:itemdesc",
    ":alchemy:itemdesc",
    ":alchemy:alchemy",
    ":alchemyplus:itemdesc",
    ":alchemyplus:alchemyplus",
    ":blacksmithy:itemdesc",
    ":blacksmithy:blacksmithy",
    ":camping:itemdesc",
    ":carpentry:itemdesc",
    ":carpentry:carpentry",
    ":cartography:itemdesc",
    ":cooking:cooking",
    ":cooking:itemdesc",
    ":cooking:grinding",
    ":fishing:itemdesc",
    ":fishing:sosarea",
    ":healing:healing",
    ":healing:itemdesc",
    ":herding:itemdesc",
    ":inscription:inscription",
    ":lumberjacking:itemdesc",
    ":mining:itemdesc",
    ":musicianship:itemdesc",
    ":snooping:itemdesc",
    ":snooping:stealme",
    ":stealing:itemdesc",
    ":tailoring:tailoring",
    ":tailoring:itemdesc",
    ":tinkering:itemdesc",
    ":tinkering:tinker",
    ":tracking:tracking",
    ":areas:itemdesc",
    ":areas:areas",
    ":auction:itemdesc",
    ":boat:itemdesc",
    ":combat:itemdesc",
    ":combat:enchantableitems",
    ":combat:hitscriptdesc",
    ":combat:modenchantdesc",
    ":combat:onhitscriptdesc",
    ":donators:itemdesc",
    ":donators:npcdesc",
    ":farming:itemdesc",
    ":farming:plants",
    ":hooks:attributes",
    ":hooks:checkskill",
    ":hooks:skillsdef",
    ":hooks:syshook",
    ":hooks:uoclient",
    ":hooks:uoskills",
    ":hooks:vitals",
    ":housing:itemdesc",
    ":loot:itemdesc",
    ":spawnpoint:itemdesc",
    ":spawnregion:spawngroups"
    };

    Foreach Effing_CFG in CONFIG_FILES
    UnloadConfigFile( Effing_CFG );
    Endforeach
   
    Unload_Scripts();
    ReloadConfiguration();

    Foreach thing in ListObjectsInBox( 0, 0, -128, 6142, 4094, 128 )
    If( thing.npctemplate )
    RestartScript( thing );
    Endif
    SleepMS( 10 );
    Endforeach

Endprogram


Got the idea yet?


Last edited by MontuZ on Sat Mar 04, 2006 10:54 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 04, 2006 10:38 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 745
Location: Chicago, IL USA
instead of restarting the server, my server has commands to just RestartScript(NPC) on the NPC.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 4:21 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 834
Location: Indiana, USA
Here is where a lot of people get a bit confused. You have to either restart the script of an npc (for example), or restart the server, becuase their AI(Script) is running, currently, and doesn't "end". That is why it has to be done. It cannot "change" it to the new code because it is still running. Same with Windows, when you do critical updates and have to reboot for them to take affect. They can't, cuz they are locked and running. Same thing here.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 1:09 pm 
As was noted above, you must restart any running control/AI script for it to take the new version. For NPC AI, that often means that a shard restart IS, in fact, necessary. There is nothing that the POL core itself should be doing to help here; a running program must be stopped before it can run the new version of itself.

BTW; if you want to restart all your NPCs, as was noted above as well, restarting all of the NPCs is a much better idea than killing them. (though restarting the shard itself is probably much easier. It is for things like this, though, that I have a regular, automatic 'daily maintenance' period on my shard)



As for your config file thing, two notes:

First; most of your listing of config files is redundant. You use wildcard entries at the top (the ones like :*:itemdesc), but then you ALSO list your itemdesc packaged files separately below. Perhaps you aren't aware that the :*: entries are wildcard entries? Below, you only need to list the specific packaged configs that you don't have the wildcard entries for above.

But second, and most important, Why? This is what I don't understand: Why do you need a way to unload ALL of your shard's config files at one time? Do you have some programmatic process that is going through updating massive numbers of your config files or something? If so, why don't you have that same process also connect to POL through a simple AUX script and send commands to unload only the exact configs that are being changed?

I just don't see any reason to force thrashing of ALL config data unless you really need to.


Scripts are a different matter here; The ability to unload all scripts IS needed frequently because changing a single include file can cause dozens of scripts to change and need to be unloaded. There are no "config includes", however.


Top
  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 1:49 pm 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
It would be nice to update a cfg file, type 1 cmd and know that it's unloaded from memory and scripts will use the new data. In some cases .unloadcfg does unload it, but other times I have to restart and it's time consuming.

I understand the thing about npcs. Restart for all your NPCs IS reasonable. But for a Cfg file? every itemdesc i've tried to unload never unloads, even when I recompile all the scripts.

I could use a simple aux script, but I don't want to. Mainly besause I don't know how to yet.

But nevermind, you still don't get my point.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 2:13 pm 
And you aren't getting our points; there are either reasons things work as they do, or there are much easier ways to do what you are trying to do.

What you are wanting is basically the equivalent of editing a Word document on your computer, saving it, and then forcing all your programs to reload everything from memory - even though only programs that have that specific Word document loaded need to just reload that one file. You don't need to close and re-open all your Excel files, Outlook E-Mails, Access Databases and Power Point presentations; Just that one Word document.

And if something you do to close and re-open that one Word document isn't working properly, you don't throw up your hands and just close everything; you figure out maybe why what you are doing isn't working. For instance, if you use Word to edit a startup file that Windows uses on booting up, you should expect to need to reboot Windows for it to take effect. Unloading ALL Office documents won't help.


And finally, I'll note this: To my knowledge, itemdesc is one of the configs that I don't believe you can really unload at all by the normal means. Recompiling scripts also has nothing to do with configs being loaded/unloaded. You also cannot add a new itemdesc.cfg somewhere and expect POL to know it's there, until you restart. Similarly, files like servers.cfg might be able to be 'reloaded' without causing an error - but it's not relevant, and won't take effect until a shard restart.


So again, it seems like you may just need to get a bit more comfortable with how the system is meant to work here.


Top
  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 4:17 pm 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
Actually I got all your points. I just wanted you guys to try to make it possible. But if you guys can't do it, which is what you're all pointing at. End of discussion/delete this topic I've solved my problem. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 10:02 am 
Actually, I'm not one of 'you guys' here; I'm not a POL dev.


Top
  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl