Jump to content
  • 0

[Request] @unloadnpcfile


Angst

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  97
  • Reputation:   20
  • Joined:  11/13/11
  • Last Seen:  

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.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  67
  • Reputation:   23
  • Joined:  11/14/11
  • Last Seen:  

Try this:

unloadscript.patch

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

not sure about Linux thought..

Edited by FatalEror
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

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

Link to comment
Share on other sites

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.

×
×
  • Create New...