.unloadall

Archive of the older Feature Request Forum Posts
Locked
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

.unloadall

Post by MontuZ »

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.
Marilla

Post by Marilla »

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.
Adrian
New User
Posts: 4
Joined: Sat Feb 04, 2006 10:59 am

Post by Adrian »

There already is a builtin textcmd .unloadall which unloads all cached scripts. See: http://poldoc.fem.tu-ilmenau.de/builtintextcmds.php
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

ALWAYS be sure to RTFM at poldoc and the core-changes.txt please.
FreeSoul
Master Poster
Posts: 90
Joined: Sat Feb 04, 2006 9:14 am

Post by FreeSoul »

MuadDib... make the sticky post with RTFM :)
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

Post by MontuZ »

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.
Hybrid

Post by Hybrid »

.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.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

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.
Marilla

Post by Marilla »

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.
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

Post by MontuZ »

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: Select all

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.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

instead of restarting the server, my server has commands to just RestartScript(NPC) on the NPC.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

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.
Marilla

Post by Marilla »

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.
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

Post by MontuZ »

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.
Marilla

Post by Marilla »

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.
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

Post by MontuZ »

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. :)
Marilla

Post by Marilla »

Actually, I'm not one of 'you guys' here; I'm not a POL dev.
Locked