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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion

Joined: 30 Jun 2019
Posts: 2

PostPosted: Sun Jun 30, 2019 12:39 pm   

Line by Line into Array???
I have used JMC for 10+ years but am looking to switch to CMUD.
However, I purchased Zmud in 1998 and still have that registered so i'm going to use that for now.
I figure the port to CMUD will be easy if i'm already on zmud.

My issues are many, but right now, i'll just focus on one.
How do I capture Line by Line, into an array.
In JMC, all my code ran in a function that was evaluated everytime a Line came from the mud. Any line.
So, for example, if I wanted to capture the Identify of an item, it would look like this:
recite identify <item> would turn a variable on called "autolore" or whatever it would be.
If this variable is turned on, then every line that comes from the mud is captured into an array, until a certain line comes across that would turn that variable off and stop the capture.
I would then write that array into a text file using Javascript. and voila, I have a .txt of all items i've identified w/out having to re-identify them in the future.

From what I can tell with Zmud, everything has to be triggered off of something. Is there a main "script" file that doesn't need a specific event to happen to trigger? it just triggers off every line that comes into the mud and then you can run code against that "line" variable, or is there just some way to do what i'm wanting to do but with Zmud functions?

All my scripts were written in Javascript with JMC.
I can post my code if you want to see it.

is there a good site somewhere that shows how to write detailed zmud scripts? i've done some searching but cant find anything that i'm looking for.

Please ask questions if i'm not being clear.
I really want to switch to Zmud but i need to get my scripts converted over!

Last edited by MIliankapoor on Fri Jul 12, 2019 7:11 pm; edited 2 times in total
Reply with quote

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

PostPosted: Wed Jul 03, 2019 12:20 am   
What you want, I believe, is a state-based #TRIGGER.
Since you are initiating it with a command, we specifically want #ONINPUT
Since the whole process is technically one setting, you also should not need the @autoLore variable.

#ONINPUT {recite identify (*)} {}
    #IF (%match(%line, "This is where you put the certain line to turn off the capture")) {#NOOP nothings happens here} {
        #STATE 1
        #VAR captureArray {%additem(%line, @captureArray)}
    } {within|param=1}

Something like that would do it. This is untested.
Also, you can access the entire reference manual from within the client, at the command line:
#HELP %additem
and so on
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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