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

%1 also contains %2 within function

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



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Sun Mar 13, 2011 12:57 pm    Post subject: %1 also contains %2 within function Reply with quote

Inside function:
Code:
#showme (you used call %1 with value %2);


Alias that calls the function:
Code:
#alias {.prefs} {@prefs{%0}}


I trigger the alias...
Code:
.prefs where 30


Output:
Code:
(you used call where 30 with value 30)



Here's the whole function:
Code:
#function {prefs}
{
   #showme ;
   #if {"%0" == "show"}
   {
      #showme Preferences;
      #foreach {$prefs[]} {tmp}
      {
         #showme $tmp = $prefs[$tmp];
      };
   };
   #elseif {"$prefs[%1]" != ""}
   {
      #if {"$prefs[%1]" == "off"} {#var prefs[%1] on};
      #elseif {"$prefs[%1]" == "on"} {#var prefs[%1] off};
      #elseif {%2 != ""} {#var prefs[$%1] {%2}};
      #showme Preference %1 is now $prefs[%1].;
   };
   #else
   {
      #showme (you used call %1 with value %2);
      #showme Preferences -- help;
      #showme ;
      #showme syntax:;
      #showme .prefs argument [value - if not on/off];
      #showme ;
      #showme arguments:;
      #showme show      Show all prefs and their values;
      #showme [pref]      Toggles on/off preference, other type is set to default;
      #showme [pref] <value>   Toggles on/off, other type is set to <value>;
      #showme ;
   };
   #var {result} {#nop};
}



This bug does not limit to this example. Same bug is in 2.00.4 and 2.00.6 as I updated to check if newer would have fixed that. (also, the function is unfinished (regarding feature mentioned in the "help"), so no need to mention about that)
Back to top
View user's profile Send private message Visit poster's website AIM Address
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Sun Mar 13, 2011 9:04 pm    Post subject: Reply with quote

You call the function with one argument, so %2 is invalid, though it probably holds the value that was assigned to it by the alias.

If you want two arguments you could use:

#alias {.prefs} {@prefs{%1;%2}

I'm not sure why you're calling a function though, an alias is basically a function that doesn't return a value.
Back to top
View user's profile Send private message Send e-mail
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Mon Mar 14, 2011 6:36 am    Post subject: Reply with quote

So, the %2 is more the bug than the %1? Big Smile

I'm just too used to functions (from PHP). Smile Maybe I should rebuild the alias to include the content of the function...

Thanks for the hint. Thumbs Up
Back to top
View user's profile Send private message Visit poster's website AIM Address
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