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


Joined: 13 Aug 2013
Posts: 8

PostPosted: Mon Jul 20, 2015 6:27 am   

Multi-line Help
 
Sorry i know there is a lot of info on here about this but i cant seem to make it work for me.
Trying to grab everything up to a period. sometimes its on the same line sometimes is on the next line.

Example
You examine the clues, sniff the air and question your intuition; you see an echo of Barracks
interior.

Example
You examine the clues, sniff the air and question your intuition; you see an echo of Path.


would like "Barracks interior" or "Path" saved to a variable but i cant seem to make it happen.
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jul 20, 2015 9:21 am   
 
If you know where the line break is, it is very simple:

#TR {You examine the clues, sniff the air and question your intuition; you see an echo of Barracks $interior. }

Just insert a the $ symbol where the carriage return would be.

Without it, is a bit more difficult, you need a state based trigger:

Code:

#TR {You examine the clues, sniff the air and question your intuition; (*)} {
  clue=%trim(%1)
  #IF (%ends(@clue, ".")) {#STATE 0}
}
#COND {(*)} {
  clue=%concat(@clue, " ", %trim(%1))
  #IF (!%ends(@clue, ".")) {#STATE 1}
}

_________________
Discord: Shalimarwildcat
Reply with quote
droxon
Newbie


Joined: 13 Aug 2013
Posts: 8

PostPosted: Mon Jul 20, 2015 9:35 am   
 
hmmm. much better than what i was trying to do. do the conditions go away? they seem to stay attached to the trigger after it finds the period. once it is ran multiple times it is looking for additional periods and ends up picking up more lines into the variable
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jul 20, 2015 7:10 pm   
 
the condition is permanently attached to the trigger.
If it finds a period in the first state. (0) then it has finished, so i forcibly reset the trigger back to state 0 because otherwise it would automatically advance to the second state (1).
If it does not find a period in the second state (1), it has to stay in the second state (1) until id does find a period, so i force it to stay there, when it would reset back to the first state (0).

If it is picking up extra lines, I want to say that the hint is ending with punctuation other than a period?

Oh, maybe this will help:
Find your trigger via the settings editor.
Select its second state.
Go to the options panel at the bottom of the trigger.
Change the type to "within llines".
And the number beside it to 1
_________________
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