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
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Sun Jan 01, 2012 9:14 am   

Function adds extra blank line after firing...why?
 
This simple function:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="writhe">
    <value>$from=%if( $from, $from, general)
$writhing=%ismember( $from, @writhefrom)
#IF (!$writhing) {
  #ADDITEM writhefrom {$from}
  #SEND {writhe%if( $from==general, %null, from%char( 32)$from)}
  }</value>
    <arglist>$from</arglist>
  </func>
</cmud>


makes the outcome be line this:

Code:

H:6136 M:6090 B:100% XP:56.46% [cdb eb]writhe

You begin to writhe helplessly, throwing your body off balance.

adding that extra space, which is annoying, especially when using multiple functions.
anyone know why it does this and how to stop it?
Reply with quote
shalimar
GURU


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

PostPosted: Sun Jan 01, 2012 2:27 pm   
 
wrap the function in %trim()
_________________
Discord: Shalimarwildcat
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jan 01, 2012 4:15 pm   
 
It's the use of #SEND that's causing it. Since this is coming from a function, does it need to be #SEND as opposed to #SENDRAW?
_________________
EDIT: I didn't like my old signature
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jan 01, 2012 4:47 pm   
 
Since it's coming from a function, shouldn't it just be #RETURN instead?

Then the command would be #SEND @writhe("argument")
Reply with quote
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Mon Jan 02, 2012 6:34 am   
 
This function does it as well.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="writhefree">
    <value>$from=%pop(writhefrom)
#IF ($from) {#SAYADD {%ansi(12)~(%ansi(15)Free%char(32)From%char(32)$from%ansi(12)~)}}</value>
  </func>
</cmud>



Code:
You begin to writhe helplessly, throwing your body off balance.(Free From armpit)

(BA 0.86)



I fixed the first one by making it #return the writhing command like this.
#RETURN {writhe%if( $from==general, %null, %char(32)from%char( 32)$from)}

also wrapping it in trim didn't help.

EDIT: nevermind I fixed it, by making it return the line's rather then SAYADD them directly, I used sayadd in the trigger that calls it.
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