Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Turncoat
Newbie


Joined: 19 Sep 2011
Posts: 5

PostPosted: Sun Dec 02, 2012 7:12 pm   

Lua table, and cmud params
 
Hello Everyone!

I have a trigger setup that finds mobs in a room, pretty easy:

Code:

^~[%w~] ~[*~] (*).$


That is the trigger part, and using zscript and doing the following, WILL work.
Code:

#ECHO %1


Going to lua, and doing the following:
Code:

tt = { [ "The large form of Muraka basks in the light." ] = "goblin"}
print(tt["The large form of Muraka basks in the light."])
print(tt[zs.param(1)])


Does not work with the last statement. I've been trying various ways, but to no avail. Accessing the variable in the second statement works fine and it prints "goblin".

I am trying to use the param as a dictionary key in lua, and am not sure how to do it. Any assistance would be greatly appreciated!

(using cmud 3.34)
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Tue Dec 04, 2012 2:01 am   
 
I am wondering what else you may be doing wrong because the above test worked for me as expected.
If Lua (via CMUD) is not throwing an error then I would examine exactly what the trigger is capturing. You may have to trim whatever you get since ["mob"], ["mob "] or [" mob"] are distinct keys.
_________________
Sic itur ad astra.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Dec 04, 2012 4:36 am   
 
Anaristos has a point there. Sometimes, a MUD doesn't end something where it should end, and you wind up capturing
Code:
This sentence ends over there ->         "

instead of
Code:
"This sentence ends right here"


You may look into using %trim or zs.func.trim(zs.param(1)) instead.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net