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
aeslynn
Newbie


Joined: 08 Apr 2019
Posts: 4

PostPosted: Mon Apr 08, 2019 4:55 pm   

Building up a raw telnet variable and accessing wildcards in #LUA
 
Hello,

I had two questions that I'd love answered -- 1. Can you build up a raw telnet sequence to send to the server? i.e.
Code:
$msdpReportableVariables = $msdpReportableVariables%char(2)HEALTH;#sendsb 69 $msdpReportableVariables
. I did try the above code but it doesn't seem to work.

2. Can you access the %wildcards from a pattern in #LUA{}?

Thanks!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Wed Apr 10, 2019 2:17 pm   
 
Nothing says you have to code entirely in Lua, you could easily just stick the lua you need inside a #LUA command, and use zscript for the rest, if you wanted.

I would use the %concat function to properly string them all together into a CMUD variable, which you can then access via lua code as zs.var.varName

Use: zs.param(n)
To reference the captured bits in a trigger.
_________________
Discord: Shalimarwildcat
Reply with quote
aeslynn
Newbie


Joined: 08 Apr 2019
Posts: 4

PostPosted: Fri Apr 12, 2019 8:30 pm   
 
shalimar wrote:
Nothing says you have to code entirely in Lua, you could easily just stick the lua you need inside a #LUA command, and use zscript for the rest, if you wanted.

I would use the %concat function to properly string them all together into a CMUD variable, which you can then access via lua code as zs.var.varName

Use: zs.param(n)
To reference the captured bits in a trigger.


I'm a bit confused. %concat still doesn't seem to create the end variable correctly. As an example, I'm trying to create a variable that starts with
Code:
%69 %char(1)REPORT
. Then, it iterates through a stringlist variable via #FORALL and should concat
Code:
%char(2)%i
. Finally, it should #sendsb the built variable.

I realize that #LUA {} works; however, I'm not sure how to access a wildcard from there. For example, a wildcard from a trigger whose match is in %2.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Apr 13, 2019 1:38 am   
 
$var=%concat("%69 %char(1)REPORT", %expandlist(@someVar), "%char(2)%i")

See '#HELP %expandlist' to get it to spit out formatting how you want it.

use zs.param(2) to access %2 in lua
_________________
Discord: Shalimarwildcat
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