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: 22 Mar 2019
Posts: 14

PostPosted: Thu Mar 28, 2019 4:58 am   

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.UC browser SHAREit Appvn

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 Kidbooo on Sat Mar 30, 2019 6:40 pm; edited 1 time in total
Reply with quote

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

PostPosted: Sat Mar 30, 2019 1:20 pm   
A state trigger would work in this example as well, just as it did for the Wholist in your other thread.

You would need to use the #FILE #READ and #WRITE commands to make the .txt files, but I am not very familiar with those.
I would likely store the information in a JSON variable database myself.
This site is the best you will find for zScript.

#TRIGGER {*} {do stuff}
Will fire off of every line.

CMUD introduced a new script type known as #EVENT which fires off of things other than triggers, though you can #RAISE them with a trigger as well: onRoomEnter, onZoneEnter, onConnect, onLoad, etc
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