Lua MUD Object Properties

Main.LuaMUDObjectProperties History

Hide minor edits - Show changes to markup

January 11, 2010, at 03:08 AM EST by Paramore
Changed lines 29-38 from:

Property Tables

Characters Table of available character properties

Objects Table of available game item properties.

Rooms Table of available room and exit properties.

Mud Table of available MUD properties.

to:
December 26, 2008, at 05:32 PM EST by Anipopo
Changed line 6 from:
to:

[@

Changed lines 10-11 from:
to:

@] [@

Changed lines 17-18 from:
to:

@]

Changed lines 20-21 from:
to:

[@

Changed lines 25-26 from:
to:

@]

December 26, 2008, at 04:04 PM EST by admin
Added line 30:
Added line 32:
Added line 34:
December 26, 2008, at 04:03 PM EST by admin
Added lines 1-33:

Accessing Object Properties

Using 'ch' as an example which represents a character object in the MUD, accessing properties is as simple as using 'ch.level', 'ch.gold', 'ch.int', etc.

Example code may be:

if ch.level > 100 then

   send(ch,"You are a noble!")

end

if ch.int < self.int --- remember, self is the mob running the prog.

   say("I'm smarter than you!")

else

   say("You're smarter than me!")

end

If you are dealing with an object, you may write something like

if obj.level < 100 then

   say ("I don't accept this low level junk!")
   mdo ("give " .. obj.name .. " " .. ch.name)

end

The line beginning 'mdo' is using Lua concatentation to create a command the character will execute in the MUD itself - in this case returning the object to the character that triggered the script.

Property Tables

Characters Table of available character properties Objects Table of available game item properties. Rooms Table of available room and exit properties. Mud Table of available MUD properties.