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
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 18, 2010 11:14 pm   

Extending a single-line show across multiple scripting lines
 
I don't believe there's a way to do this, though it would be something I would suggest to consider for future implementation. Currently, if you break #show into multiple parts, they each go on separate lines. This is obviously far more useful than my suggestion, so I'm thinking of something more like a #showadd command which would be used in this rarer circumstance. When lines get particularly long, using CMUD wrapping features can get fairly messy looking. And it would be much more convenient then to be able to extend the #show statement across multiple lines.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Apr 19, 2010 12:08 am   
 
err, why not just use multiple #SHOW commands? Or use a $local variable that you can append different smaller chunks to?
_________________
EDIT: I didn't like my old signature
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Apr 19, 2010 1:46 am   
 
Using multiple #show commands puts them on different lines. Currently, I tend to use a lot of local variables. However, I don't think I can put functions inside local variables, no?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Apr 19, 2010 2:48 am   
 
Why would you want to put functions inside a variable?

$var = %concat(@function(),%function(),"more text")
repeat until you get the entire line built
#show $var
_________________
EDIT: I didn't like my old signature
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Apr 19, 2010 6:31 am   
 
Here's an example line that would get messy:

#show "You have searched through "$_entry" entr"%if($_entry>1, "ies", "y")" so far. However, you have "$_m_entry" entr"%if($_m_entry>1, "ries", "y")" left to search through."
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Apr 19, 2010 11:05 am   
 
Use #SAYADD instead?
_________________
Taz :)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Apr 19, 2010 5:42 pm   
 
#sayadd will append itself to the next line from the MUD before it appends itself to the last line (such as from #show) at least in my experience.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Apr 19, 2010 5:58 pm   
 
One would assume that if a command #showadd was to be implemented it would work in the same way as #sayadd otherwise you would then have screen printing commands with a similar name that act differently leading to confusion.

Also perhaps you want #showprompt?
_________________
Taz :)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Apr 19, 2010 6:04 pm   
 
#showprompt might work, I'd have to play with it. And, if #showadd were added, the hope would be that it did function differently from sayadd, namely it would cmud output as its priority over mud output.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Apr 19, 2010 6:09 pm   
 
Quote:

#show "You have searched through "$_entry" entr"%if($_entry>1, "ies", "y")" so far. However, you have "$_m_entry" entr"%if($_m_entry>1, "ries", "y")" left to search through."


$format = "You have searched through &0.0f entr&s so far. However, you have &0.0f entr&s left to search through."
#show %format($format,$_entry,$if($_entry > 1,"ies","y"),$m_entry,,$if($_entry > 1,"ies","y"))

Not seeing the messy from this side of the screen.
_________________
EDIT: I didn't like my old signature
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Apr 19, 2010 6:11 pm   
 
Well, you're a GURU and I'm not. You see things differently than I do!
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Apr 19, 2010 6:24 pm   
 
chamenas wrote:
#showprompt might work, I'd have to play with it. And, if #showadd were added, the hope would be that it did function differently from sayadd, namely it would cmud output as its priority over mud output.

In which case it would likely get a different name.

Also perhaps you can clarify exactly what you want as your title says "Extending a single-line show across multiple scripting lines" and then you go on to say "Currently, if you break #show into multiple parts, they each go on separate lines."

What the heck is the difference in reality? In the end you have text on multiple lines!

Perhaps you just want to insert a forced return character?

#show {This is an extremely long line of text with lots of things on it that can potentially make%{crlf}it look rubbish unless it splits onto multiple lines}
_________________
Taz :)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Apr 20, 2010 12:20 am   
 
No, I want the opposite of that. I'd like a command where I can have say:
#show "This is stuff. "
#showadd "But I'm not finished."

Would show up in cmud as:
This is stuff. But I'm not finished.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Apr 20, 2010 12:35 am   
 
#showprompt "This is stuff. "
#show "But I'm not finished."

WILL show up in CMUD as:
This is stuff. But I'm not finished.

So for as long as you want the shows to keep adding to the line you use showprompt first and then when you want to finish the line and have a carriage return you use a standard show.
_________________
Taz :)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Apr 20, 2010 1:01 am   
 
Personally, I don't see any real use for this command. Either do it the way Taz has shown or the way MattLofton has shown. For clarification on Matt's example:

$showme="This is stuff."
$showme=%concat($showme," But I'm not finished.")
$showme=%concat($showme," And here is some more.")
$showme=%concat($showme," Now I am finished.")
#SHOW {$showme}

A ridiculous example, but at least you can break it down step-by-step to see what you're adding when. No need to make a whole new command that probably only you would use.

Charneus
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Apr 20, 2010 9:26 am   
 
charneus wrote:
No need to make a whole new command that probably only you would use.

No need because it already exists. He's just thinking in reverse.

Why put a show and then use a new command that removes the carriage return that the show put when you can use a show command that doesn't have a carriage return in the first place?
_________________
Taz :)
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