User Tools

Site Tools


lua:ch:carries

Differences

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

Link to this comparison view

Next revision
Previous revision
lua:ch:carries [2017/02/20 05:54] – created vodurlua:ch:carries [2024/07/09 03:06] (current) astark
Line 1: Line 1:
-CH:carries( arg[string)+CH:carries( arg<string>|<integer> )
  
 Return type: boolean | integer Return type: boolean | integer
  
-arg can be a vnum or a name. Return false if CH does not carry any object with that vnum/name, otherwise return the count of that vnum/name carried.+arg can be a vnum or a name. Vnum doesn't need to be stringified. Return false if CH does not carry any object with that vnum/name, otherwise return the count of that vnum/name carried. 
 + 
 +<code lua> 
 +-- DEATH. Chemist. Loads vials on random chance but intelligently. 
 +dark = false 
 +yellow = false 
 +blue = false 
 +green = false 
 + 
 +for _,players in ipairs(mob.room.players) do 
 +  if players:carries("20110") or players:ccarries("20110") then 
 +    dark = true 
 +  end 
 +  if players:carries("20111") or players:ccarries("20111") then 
 +    yellow = true 
 +  end 
 +  if players:carries("20112") or players:ccarries("20112") then 
 +    blue = true 
 +  end 
 +  if players:carries("20113") or players:ccarries("20113") then 
 +    green = true 
 +  end 
 +end 
 + 
 +echo("passed for loop"
 + 
 +if rand(70) then 
 +  if dark == false then 
 +    mob:oload(20110) 
 +  elseif yellow == false then 
 +    mob:oload(20111) 
 +  elseif blue == false then 
 +    mob:oload(20112) 
 +  elseif green == false then 
 +    mob:oload(20113) 
 +  end 
 +end 
 + 
 +</code>
  
  
lua/ch/carries.1487570041.txt.gz · Last modified: 2017/02/20 05:54 by vodur