|
XonDK Apprentice
Joined: 01 Dec 2006 Posts: 178
|
Posted: 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? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Sun Jan 01, 2012 2:27 pm |
wrap the function in %trim()
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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") |
|
|
|
XonDK Apprentice
Joined: 01 Dec 2006 Posts: 178
|
Posted: 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. |
|
|
|
|
|