<div dir="ltr"><div><div><div>Actually, we do have a way of testing if an NPC doesn't exist at all<br><br></div>if(get NPC id(ref) == -1) then()<br><br></div>My use case for "NPC is disabled" is when I am looping through all possible NPC ids, and doing actions on them based on their NPC id<br>
<br>script, create objects from npcs, begin<br>  variable(ref, pic, sl, nd, d, item)<br>  for(ref, -300, -1) do(<br>    sl := 0<br>    if(get NPC id(ref) >= 0 && not(NPC is disabled(ref))) then(<br>      pic := read npc(ref, NPCstat:picture)<br>
      nd := npc direction(ref)<br>      switch(nd) do(<br>        case(left, right) do(<br>          sl := create monster by id(pic)<br>          if(nd == left) then(d := -1)<br>          if(nd == right) then(d := 1)<br>        )<br>
        case(up, down) do(<br>          sl := create monster spawner(pic)<br>          if(nd == up) then(d := -1)<br>          if(nd == down) then(d := 1)<br>        )<br>      )<br>    )<br>    if(sl) then(<br>      set slice x(sl, npc x(ref) * 20 + 10)<br>
      set slice y(sl, npc y(ref) * 20 + 19)<br>      set direction(sl, d)<br>    )<br>    destroy npc(ref)<br>  )<br>end<br><br></div>But if you think it would be best to make "NPC is disabled" return true for non-existant NPCs too, I can easily make that change.<br>
<div><div><div><br>---<br></div><div>James<br><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 2, 2014 at 12:22 AM, Ralph Versteegen <span dir="ltr"><<a href="mailto:teeemcee@gmail.com" target="_blank">teeemcee@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I notice that this returns false if the NPC doesn't exist at all. (And<br>
I assume that the intention is that if we had a better switch to<br>
enable script warnings, then this would throw a warning/error<br>
instead.)<br>
But we don't seem to have a direct way to check whether an NPC<br>
reference is valid at all. It would be useful.<br>
<div class="HOEnZb"><div class="h5"><br>
On 2 February 2014 16:54,  <<a href="mailto:subversion@hamsterrepublic.com">subversion@hamsterrepublic.com</a>> wrote:<br>
> james<br>
> 2014-02-01 19:54:52 -0800 (Sat, 01 Feb 2014)<br>
> 119<br>
> New plotscripting command "NPC is disabled" for detecting when an NPC reference is disabled by tags or by one-time-use<br>
> ---<br>
> U   wip/<a href="http://const.bi" target="_blank">const.bi</a><br>
> U   wip/docs/plotdict.xml<br>
> U   wip/docs/plotdictionary.html<br>
> U   wip/plotscr.hsd<br>
> U   wip/whatsnew.txt<br>
> U   wip/yetmore.bas<br>
> _______________________________________________<br>
> Ohrrpgce mailing list<br>
> <a href="mailto:ohrrpgce@lists.motherhamster.org">ohrrpgce@lists.motherhamster.org</a><br>
> <a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" target="_blank">http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org</a><br>
_______________________________________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org">ohrrpgce@lists.motherhamster.org</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" target="_blank">http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org</a><br>
</div></div></blockquote></div><br></div>