User Tools

Site Tools


lua:scripting:examples:runequestorig

Differences

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

Link to this comparison view

lua:scripting:examples:runequestorig [2014/12/24 05:39] – created vodurlua:scripting:examples:runequestorig [2026/10/16 20:04] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====Rune Quest (original version)==== 
  
-<code lua> 
-runevnum=31470 
-homevnum=31404 
-maxrune=50 
-checktime=nil 
-checkdelay=300 -- 5 mins 
- 
- 
-function runereward() 
-  local runes=getobjworld(runevnum) 
-  for _,rune in pairs(runes) do 
-    char=rune.carriedby 
-    if char then 
-      goto(char.room.vnum) 
-      if char:ispc() then 
-        echo(string.format("%s glows brightly and evaporates into the air!", rune.shortdescr)) 
-        reward(string.format("%s qp 5", char.name) ) 
-      end 
-    end 
-    rune:destroy() 
-  end 
- 
-  goto(homevnum) 
-  mdo("chirp") 
-end 
- 
-function place() 
-  local runes=getobjworld(runevnum) 
-  local count=table.getn(runes) 
-  if count >= maxrune then 
-    return 
-  end 
- 
-  for i=1,maxrune-count do 
-    goto("wrandom") 
-    oload(runevnum) 
-    mdo("drop rune") 
-  end 
- 
-  goto(homevnum) 
-end 
- 
-function checkrunes() 
-  local currtime=os.time() 
-  if checktime==nil then 
-    checktime=currtime+checkdelay 
-    return 
-  elseif currtime<checktime then 
-    return 
-  end 
- 
-  runereward() 
-  place() 
- 
-  checktime=currtime+checkdelay 
-end 
- 
-runeloaded=true 
-</code> 
- 
-<code> 
-MOBPrograms for [31425]: 
- Number Vnum Trigger Phrase 
- ------ ---- ------- ------ 
-[    0] 31404  RANDOM 100 
- 
-Vnum:       [31404] 
-Lua:        True 
-Code: 
- 
-if not runeloaded then 
-  loadscript("vodur", "rune1") 
-end 
- 
-checkrunes() 
-</code>