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
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Mon Jan 19, 2009 4:18 pm   

Buttons and Send with LUA
 
From the help file:

Quote:
The text is sent just as if you typed it, so it is echoed to the screen and available for #ONINPUT triggers.


This will work if I send it from another oninput trigger. However, if I do it from a button it will not work and just echoes to the screen.

Test code:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="SendTest" copy="yes">
    <trigger type="Command Input" priority="100" case="true" regex="true" copy="yes">
      <pattern>^test$</pattern>
      <value>zs.noinput()
if zs.var.testvar == 0 then
  send("checkon")
  zs.var.testvar = 1
else
  send("checkoff")
  zs.var.testvar = 0
end </value>
    </trigger>
    <trigger type="Command Input" priority="110" case="true" regex="true" copy="yes">
      <pattern>^checko(n|ff)$</pattern>
      <value>zs.noinput()
local a = zs.param(1)
if a == "n" then
  print("ON")
else
  print("OFF")
end </value>
    </trigger>
    <button priority="120" copy="yes">
      <caption>Test</caption>
      <value>if zs.var.testvar == 0 then
  send("checkon")
  zs.var.testvar = 1
else
  send("checkoff")
  zs.var.testvar = 0
end </value>
    </button>
    <var name="testvar" usedef="true" copy="yes">
      <value>1</value>
      <default>0</default>
    </var>
  </class>
</cmud>


Using oninput trigger I get the output:

ON
OFF
ON
OFF
ON
OFF
ON
OFF

Using button I get the output of:

checkon
checkoff
checkon
checkoff
checkon
checkoff
checkon
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Jan 20, 2009 6:23 pm   
 
Added to bug list.
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