TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Alias argument %0 sorting problem

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
balthus



Joined: 07 Jul 2009
Posts: 39

PostPosted: Thu Feb 18, 2010 11:08 am    Post subject: Alias argument %0 sorting problem Reply with quote

When passing multiple arguments to an alias, the order they appear in %0 isn't consistent.

Code:

#alias {test}
{
  #VAR testvar {%0};
  #ECHO {%1 : %2 : %3};
  #VAR testvar;
};

test {something} {something else} {another one}


produces:

Quote:

something : something else : another one
#VARIABLE {testvar}={{another one}{}{something}{something else}}



As you can see, %1, %2 etc are in the right order, but in the testvar they're in a completely different order (with a blank extra coming from somewhere)

Is there a way I can loop through n arguments passed to an alias and keep the order of passed arguments intact, without knowing the number of arguments in advance?

(tested on version 1.99.8 and 2.0)
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Thu Feb 18, 2010 10:16 pm    Post subject: Reply with quote

You're creating an associative array, which is why the order is messed up.

The easiest work around is probably:

Code:

#alias {test}
{
  #var testvar {%1};
}

test {a;b;c}

#forall {$testvar} {#showme (&0)}


You can also use: test a,b,c and use: #replace test {,} {;} in the alias so there's no need to add braces.

Alternatively you can use your original alias and input:
Code:

test {1}{something}{2}{something else}{3}{another one}

#forall {$testvar[%*]} {do something}
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group