lua:scripting:examples:sharinginfo
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lua:scripting:examples:sharinginfo [2014/12/24 05:30] – vodur | lua:scripting:examples:sharinginfo [2015/09/28 04:22] (current) – vodur | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | |||
+ | **Note that as of today (9/ | ||
+ | |||
We know how to make 1 mob remember a player by saving their name in a variable or table, but what if we wanted that information available to other mobs or even objects and area scripts? For this we can use ' | We know how to make 1 mob remember a player by saving their name in a variable or table, but what if we wanted that information available to other mobs or even objects and area scripts? For this we can use ' | ||
Angels in the gauntlet at Angel' | Angels in the gauntlet at Angel' | ||
- | A few things we need before we start: | + | A few things we need before we start: angel vnum ( 10709 ) 2 mprog vnums to use ( we'll use 10703 and 10704) |
- | angel vnum ( 10709 ) | + | |
- | 2 mprog vnums to use ( we'll use 10703 and 10704) | + | |
Let's start off simple and just make a [[: | Let's start off simple and just make a [[: | ||
Line 44: | Line 46: | ||
</ | </ | ||
- | Now for the secret sauce. | + | Now for the secret sauce. Note that ' |
- | Note that ' | + | |
<code lua> | <code lua> | ||
say(" | say(" | ||
Line 66: | Line 68: | ||
Ok, it LOOKS like it's working, but how do we know if the info got saved? If we did it right, there is a file called " | Ok, it LOOKS like it's working, but how do we know if the info got saved? If we did it right, there is a file called " | ||
- | We'll set up our 2nd trigger and prog now. We'll have a [[MprogGreet|greet]] trigger that fires 100% of the time. | + | We'll set up our 2nd trigger and prog now. We'll have a [[: |
< | < | ||
Line 93: | Line 95: | ||
tprint(tbl) | tprint(tbl) | ||
</ | </ | ||
- | |||
< | < | ||
Line 102: | Line 103: | ||
bless, to find a balm for woe, to tend the lone and featherless, | bless, to find a balm for woe, to tend the lone and featherless, | ||
angel' | angel' | ||
- | they visit the mortal realm. | + | they visit the mortal realm. |
[Exits: north east] | [Exits: north east] | ||
Line 128: | Line 129: | ||
return -- exit the script | return -- exit the script | ||
end | end | ||
- | + | ||
say(ch.name..", | say(ch.name..", | ||
kill(ch.name) | kill(ch.name) | ||
Line 134: | Line 135: | ||
And an update to 10703 | And an update to 10703 | ||
+ | |||
<code lua> | <code lua> | ||
Vnum: | Vnum: | ||
Line 144: | Line 146: | ||
tbl.killer=ch.name | tbl.killer=ch.name | ||
savetbl(" | savetbl(" | ||
- | + | ||
- | -- Any angels in the room attack! | + | -- Any angels in the room attack! |
for _,char in pairs(mob.room.people) do | for _,char in pairs(mob.room.people) do | ||
if char.vnum==mob.vnum then | if char.vnum==mob.vnum then | ||
Line 155: | Line 157: | ||
Final notes: savetbl and loadtbl will always save/load in area specific directory (angel' | Final notes: savetbl and loadtbl will always save/load in area specific directory (angel' | ||
+ | |||
+ |
lua/scripting/examples/sharinginfo.1419399017.txt.gz · Last modified: 2014/12/24 05:30 by vodur