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
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Tue Jan 07, 2014 3:30 pm   

Line by Line into Array?
 
Hello.
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!

Thanks,
Derek Conlon
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jan 08, 2014 12:28 am   
 
sounds like you just want to log what you are doing... have you looked into the #LOG command?

alternatively something like this would do as you propose

#TRIGGER {^(*)$} {#IF (@autoLore=1) {#VAR anyLine {%additem(%1, @anyLine)}}}

you could also name the trigger and use #T+/- to toggle it
_________________
Discord: Shalimarwildcat
Reply with quote
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Wed Jan 08, 2014 2:25 am   
 
Yes, thank you very much.
I was wondering if (*) would work as my "Line" variable.
I appreciate your reply.
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 Wolfpaw.net