Jump to content
  • 0

[Request] @unloadnpcfile


Question

Posted

I'd like to request an edit to the command @unloadnpc to unload the whole text file by directory.

Like @loadnpc <directory>/file.txt

Unloadnpc would do the same thing but unload: @unloadnpc <directory>/file.txt

This way @loadnpc <directory>/file.txt doesn't create duplicates.

Thanks for your time.

3 answers to this question

Recommended Posts

Posted

I'd like to request an edit to the command @unloadnpc to unload the whole text file by directory.

Like @loadnpc <directory>/file.txt

Unloadnpc would do the same thing but unload: @unloadnpc <directory>/file.txt

This way @loadnpc <directory>/file.txt doesn't create duplicates.

Thanks for your time.

Only hardly possible. When loading NPCs, they are parsed and then saved, but not by their source but by their unique name. That's why there is @unloadnpc <name> but @loadnpc <file>. To do this you would have to keep track of any NPC in any file or go through the whole file looking for NPCs and check whether they exist and then remove them. I suggest just using @unloadnpc <name> to unload NPCs...

Posted

Try this:

Tested and working on my Windows(rathena-10.sln),

not sure about Linux thought..

Looking over your patch it does what I described. But I would refrain from using this method but much rather suggest sv_parse. It parses a string with delimiters. It is also used by the npc_parsesrcfile() function, which loads all scripts. I think your code might have problems for example when I use the warp command after a tab or similiar.

Also I have a question, how does this behave:

strtok(NULL, " ");

You use this three times and I don't get it. I appreciate you share you knowledge

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...