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


Joined: 07 Aug 2002
Posts: 4
Location: Ireland

PostPosted: Mon Apr 28, 2003 7:01 pm   

Multiline to variable..
 
Ok I am totally lost as to how to do this one.

I need to set up a trigger to capture all of what an NPC says in one sentence so I can do further processing on it.

Basically what I am trying to do is make a list of people the NPC has seen and keep their descriptions seperate.

[Mud Output]
You ask the Guard: people
>
The guard says: I have seen a black-haired blue-eyed male human, a blah blah female human, a blah blah male sheep and a blah blah female horse lately.
>
[End of Mud Output]

I cant capture all this as it does not come from the mud in one sentence and can be up to about 6 lines long and any other attempts to capture it have ended up in infinite loops.

Im guessing that I will have to capture each line as a seperate line and then concat the lines into one var but I am unsure of how to do this.

Most of my mud output comes like this so if I can get it working for one I can get it working for all.

Thanks, in advance,
Dev
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Apr 28, 2003 8:33 pm   
 
[Mud Output]
You ask the Guard: people
>
The guard says: I have seen a black-haired blue-eyed male human, a blah blah female human, a blah blah male sheep and a blah blah female horse lately.
>
[End of Mud Output]

Your example has what the guard says all on one line. Is this true or is on different lines:

The guard says: I have seen a black-haired blue-eyed male human, a blah blah
female human, a blah blah male sheep, a blah dwarf tossing giant, a knight of
the lala order and a blah blah female horse lately.


Ton Diening
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Apr 28, 2003 9:01 pm   
 
Assuming one line response:

#CLASS {KnowledgeBaseWho}
#VAR KBWspace {%replace({%1},"_"," ")}
#VAR KBWunspace {%replace( {%1}, " ", "_")}
#VAR KBWlist {%replace( %replace( "%1", " and ", "|"), ", ", "|")}
#VAR KBWCurrent {the_Guard}
#VAR KBW {the_Guard}
#TRIGGER {^You ask (*): people$} {#CLASS "KnowledgeBaseWho|Data";#VAR KBWCurrent @KBWunspace({%1});#ADDITEM KBW @KBWCurrent}
#COND {@KBWspace(@KBWCurrent) says: I have seen (*) lately.} {#ADDKEY KBW@KBWCurrent %time( ddmmmyy hh:mm) @KBWlist("%1");#CLASS 0} {within|param=5}
#CLASS 0

Depends on exactly what you want to do with your data mining. This sorts it by time. If you are using the mapper you can incorporate the room number/name etc.

To see it all:
#FORALL @KBW {#SH %ansi(white)%i%ansi(default) %crlf%expanddb(@KBW%i,%crlf,": ")}

To see just the results from "the guard" (alias it up to simply accessing the info):

#SH the guard:%crlf%expanddb(@{KBW@{KBWunspace("the guard")}},%crlf,": ")

Ton Diening
Reply with quote
dev99
Newbie


Joined: 07 Aug 2002
Posts: 4
Location: Ireland

PostPosted: Tue Apr 29, 2003 4:29 pm   
 
The list of people comes from the mud as seperate lines but I managed to get it to work to capture each line starting at "I have seen" until it reaches "lately."

Thanks for your help because my script is basically taking bits from yours.

Many thanks,
Dev


Last edited by dev99 on Wed Oct 19, 2005 4:01 am; edited 1 time in total
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