Difference between revisions of "Manual:DIL Manual/findsymbolic()"
Jump to navigation
Jump to search
(XML import of LLM wiki pages) |
|||
| Line 1: | Line 1: | ||
| + | |||
| + | |||
| + | <span id="bffinds"></span> | ||
unitptr findsymbolic ( s : string ) | unitptr findsymbolic ( s : string ) | ||
| − | s : Symbolic name of the | + | s : Symbolic name of the NPC or Object to find. |
return: A pointer to an instance of the unit, or null. | return: A pointer to an instance of the unit, or null. | ||
Example: findsymbolic("bread@midgaard") | Example: findsymbolic("bread@midgaard") | ||
| − | This routine supplements findunit | + | This routine supplements findroom and findunit. It comes in handy,if it is |
| − | important to get a | + | important to get a correct reference to a NPC in the world. If for example, |
| − | + | Mary needs to send a message to John the Lumberjack, then she should NOT | |
| − | + | use the findunit() since it may locate a different John - even a player! | |
| − | Mary needs to send a message to John the Lumberjack, then she should NOT | + | If she instead locates him using findsymbolic("john@haon_dor") she will be |
| − | use the findunit() since it may locate a different John - even a player! | + | certain that it is in fact her husband, and not the player John Dow from |
| − | If she instead locates him using findsymbolic("john@haon_dor") she will be | + | Norway. It will NOT locate rooms, for the only reason that findroom is a |
| − | certain that it is in fact her husband, and not the player John Dow from | + | lot more efficient. |
| − | Norway. | + | |
| − | |||
| − | |||
| − | |||
unitptr findsymbolic ( u : unitptr, s : string, i : integer ) | unitptr findsymbolic ( u : unitptr, s : string, i : integer ) | ||
| Line 24: | Line 24: | ||
Example: findsymbolic(self, "bread@midgaard", FIND_UNIT_INVEN) | Example: findsymbolic(self, "bread@midgaard", FIND_UNIT_INVEN) | ||
| − | This routine supplements findroom, findunit and findsymbolic(#). | + | This routine supplements findroom, findunit and findsymbolic(#). It comes in |
| − | + | handy, if it is important to get a correct reference to a unit somewhere | |
| − | It comes in handy, if it is important to get a correct reference to a unit somewhere | + | relative to 'u'. If for example, Mary needs to check if she has her own |
| − | relative to 'u'. If for example, Mary needs to check if she has her own | + | cooking pot, then she should NOT use the findunit since it may locate a |
| − | cooking pot, then she should NOT use the findunit since it may locate a | + | different pot, not belonging to Haon-Dor but to some other zone. If she |
| − | different pot, not belonging to Haon-Dor but to some other zone. If she | + | instead locates it using findsymbolic(self, "pot@haon_dor", FIND_UNIT_IN_ME) |
| − | instead locates it using findsymbolic(self, "pot@haon_dor", FIND_UNIT_IN_ME) | + | she would be certain that it is in fact her own cooking pot that she is |
| − | she would be certain that it is in fact her own cooking pot that she is | + | carrying around, and not some other pot from a Joe Blow's zone. |
| − | carrying around, and not some other pot from a Joe Blow's zone. | ||
| − | + | ---~---~---~---~---~---~---~---~--- | |
| − | + | ||
| − | + | dilbegin zonelog (s:string); | |
| − | + | code | |
| − | + | { | |
| + | flog (self.zonidx+".log",s,"a"); | ||
| + | return; | ||
| + | } | ||
| + | dilend | ||
| + | |||
| + | ---~---~---~---~---~---~---~---~--- | ||
| − | + | </i><!--ENDCODE--> | |
| − | + | The previous DIL function will work in any zone to log to a file with that zones | |
| − | + | name each zone could use it to keep zone logs separate. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | ---~---~---~---~---~---~---~---~--- | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 10:43, 4 December 2025
unitptr findsymbolic ( s : string )
s : Symbolic name of the NPC or Object to find.
return: A pointer to an instance of the unit, or null.
Example: findsymbolic("bread@midgaard")
This routine supplements findroom and findunit. It comes in handy,if it is
important to get a correct reference to a NPC in the world. If for example,
Mary needs to send a message to John the Lumberjack, then she should NOT
use the findunit() since it may locate a different John - even a player!
If she instead locates him using findsymbolic("john@haon_dor") she will be
certain that it is in fact her husband, and not the player John Dow from
Norway. It will NOT locate rooms, for the only reason that findroom is a
lot more efficient.
unitptr findsymbolic ( u : unitptr, s : string, i : integer ) u : Search is relative to this unit. s : Symbolic name of the NPC or Object to find. i : FIND_UNIT_XXX bit vector of places to search. return: A pointer to an instance of the unit, or null. Example: findsymbolic(self, "bread@midgaard", FIND_UNIT_INVEN)
This routine supplements findroom, findunit and findsymbolic(#). It comes in handy, if it is important to get a correct reference to a unit somewhere relative to 'u'. If for example, Mary needs to check if she has her own cooking pot, then she should NOT use the findunit since it may locate a different pot, not belonging to Haon-Dor but to some other zone. If she instead locates it using findsymbolic(self, "pot@haon_dor", FIND_UNIT_IN_ME) she would be certain that it is in fact her own cooking pot that she is carrying around, and not some other pot from a Joe Blow's zone.
---~---~---~---~---~---~---~---~---
dilbegin zonelog (s:string);
code
{
flog (self.zonidx+".log",s,"a");
return;
}
dilend
---~---~---~---~---~---~---~---~---
The previous DIL function will work in any zone to log to a file with that zones name each zone could use it to keep zone logs separate.
---~---~---~---~---~---~---~---~---