User Tools

Site Tools


lua:scripting:examples:trackingplayers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
lua:scripting:examples:trackingplayers [2014/12/24 05:25] vodurlua:scripting:examples:trackingplayers [2017/02/16 19:50] (current) vodur
Line 1: Line 1:
 Let's make a Nog the Librarian be able track the last thing that any given player has said. Let's make a Nog the Librarian be able track the last thing that any given player has said.
  
-Nog already has a couple of mprogs, but we add 1 more, a [[:triggers:mprog:speech|speech]] trigger that will fire every time. +Nog already has a couple of mprogs, but we add 1 more, a [[:triggers:mprog:speech|speech]] trigger that will fire every time. We will use vnum 10289.
-We will use vnum 10289.+
  
 <code> <code>
Line 24: Line 23:
 tprint(tracker) -- just for debug, will remove this later tprint(tracker) -- just for debug, will remove this later
 </code> </code>
-Yes, it's as easy as that! 'tracker' will be a table of keys and values where the key will be a player name (a string)and the value will be 'trigger' which in this case will be what they said (another string). We will use 'tprint' to see what the table looks like.+ 
 +  Yes, it's as easy as that! 'tracker' will be a table of keys and values where the key will be a player name (a string)and the value will be 'trigger' which in this case will be what they said (another string). We will use 'tprint' to see what the table looks like. 
 <code> <code>
 You say 'hi' You say 'hi'
Line 41: Line 42:
 ' '
 </code> </code>
-Maybe it's a little ugly but it confirms that things are working like we want them to.  
  
 +  Maybe it's a little ugly but it confirms that things are working like we want them to.
  
-So only one thing is missing now; we need a real way for Nog to tell us what we said (not tprint)! We'll need another trigger and another prog for this. Let's use 10290 on a [[MprogSocial|social]] trigger for the 'poke' social.+So only one thing is missing now; we need a real way for Nog to tell us what we said (not tprint)! We'll need another trigger and another prog for this. Let's use 10290 on a [[:triggers:mprog:social|social]] trigger for the 'poke' social.
  
 <code> <code>
Line 58: Line 59:
 [    3] 10287     ACT gets a map of bastion [    3] 10287     ACT gets a map of bastion
 </code> </code>
- 
  
 <code lua> <code lua>
Line 75: Line 75:
  
 And remove the tprint line from 10289 And remove the tprint line from 10289
 +
 <code lua> <code lua>
 -- vnum 10289 -- vnum 10289
Line 106: Line 107:
  
 Nog says 'Odoth, the last thing you said to me was: heheheheHE' Nog says 'Odoth, the last thing you said to me was: heheheheHE'
- 
 </code> </code>
 +
  
lua/scripting/examples/trackingplayers.1419398727.txt.gz · Last modified: 2014/12/24 05:25 by vodur