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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Wed Jul 15, 2009 4:35 pm   

Lua zs.trigger interface
 
Ok, I've set up a few aliases to Edit trigger patterns from LUA, and I'm not sure if this qualifies as a bug, a kink in scripting or what.

If you have an unnamed trigger, with pattern "test" and from LUA you change the pattern to "^test", the trigger gets named "test". Now I understand that this is because unnamed triggers have the name of the first 64 characters of the pattern, BUT if you edit that trigger from the package editor the trigger remains unnamed.

Now if this is how trigger pattern editing from LUA should behave, then to maintain trigger names, and lack there of, I believe that this is the code to prevent or correct this.

Code:
  if (string.sub(trig.trigger,1,64) == string.sub(trig.name,1,64)) then
    temp = ""
  else
    temp = trig.name
  end
  pat = trig.trigger
  trig.trigger = newtriggpattern
  if temp == "" then trig.name = string.sub(trig.trigger,1,64) else trig.name = temp end


This APPEARS to work correctly, but i'm not 100% confident in it yet. Setting the trigger name to nothing, and to the entire trigger pattern both.. sorta seemed to work.

I geuss my questions are:

1, Is this the correct & desired behavior of the zs.trigger (.trigger & .name properties) object?
2, If this is the correct behavior, does anyone see any potential problems using this approach to preventing trigger name change?

Thanks!
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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