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

Possible bug with actions and aliases

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



Joined: 19 Nov 2010
Posts: 73
Location: /dev/null

PostPosted: Tue Sep 27, 2011 11:17 am    Post subject: Possible bug with actions and aliases Reply with quote

I have made the following action that detects if you have the spell icebolt. If the skill is present it sets the icebolt variable to true so other actions that depend on it can use it if it is there. I also have it define 2 aliases for making the spell cast easier to do. the first alias gets defined but the second doesn't. The second alias does work if I put it in by hand, so I know it should work but it doesn't for some reason. here's the code:
#ACTION {^ %1 icebolt%2}
{
#variable {icebolt} {true};
#alias {{iceb|icebo|icebol|icebolt}} {c icebolt};
#alias {{iceb|icebo|icebol|icebolt} %1} {c icebolt %1}
}
{5}
Also, is ther an easier way to do this in one alias?
_________________
Storm
Follow me at https://social.stormdragon.tk
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: Tue Sep 27, 2011 7:01 pm    Post subject: Reply with quote

The first alias probably triggers first. So you change the priority from the default of 5 to 4.

#alias {{iceb|icebo|icebol|icebolt} %1} {c icebolt %1} {4}

What also works is using:

#alias {{iceb|icebo|icebol|icebolt}%*} {c icebolt%0};
Back to top
View user's profile Send private message Send e-mail
stormdragon2976



Joined: 19 Nov 2010
Posts: 73
Location: /dev/null

PostPosted: Wed Sep 28, 2011 10:37 am    Post subject: Reply with quote

There's a new problem. The alias is only created when the skill or spell is found in the skills or spells list. When I use the %* tmethod and cast on %0 I am getting:
"You want to cast the spell where?"
So, I did a little debugging, and apparently it is keeping the information from the trigger that creates the alias. I used the spell bless and added a #showme. Here's what I got:
Now blessing bless average
You want to cast the spell where?
here's the trigger that creates the alias:
#ACTION {^ %1bless%2}
{
#variable {bless} {true};
#alias {^{ble|bles|bless}%*} {#showme {Now blessing%0};c bless%0}
}
{5}
I thought passing new arguments would solve this, but maybe I need to escape the % symbols or something. I'll give that a try.
_________________
Storm
Follow me at https://social.stormdragon.tk
Back to top
View user's profile Send private message Visit poster's website AIM Address
stormdragon2976



Joined: 19 Nov 2010
Posts: 73
Location: /dev/null

PostPosted: Wed Sep 28, 2011 11:34 am    Post subject: Reply with quote

Escaping the % didn't work. Just to make sure I did it right you put 2 % like %%2? It still seemd to think I was trying to cast bless on bless.
_________________
Storm
Follow me at https://social.stormdragon.tk
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: Wed Sep 28, 2011 6:25 pm    Post subject: Reply with quote

My mistake, {<stuff>} is %1 and %* will be %2:

#alias {^{ble|bles|bless}%*} {#showme {Now blessing%%2};c bless%%2}
Back to top
View user's profile Send private message Send e-mail
stormdragon2976



Joined: 19 Nov 2010
Posts: 73
Location: /dev/null

PostPosted: Thu Sep 29, 2011 6:09 am    Post subject: Reply with quote

I couldn't get it to work. It kept giving me part of the word bless as the argument as in:
now blessingbl or when I moved the argument to %3 now blessingess
I even took the alias out of the action and tried it that way but still got odd things from %0, so I finally did it like this, outside the action as stand alone aliases:
#alias {^{ble|bles|bless}} {#if {"$bless" == "true"} {c bless}} {9}
#alias {^{ble|bles|bless} %1} {#if {"$bless" == "true"} {c bless %1}} {8}
_________________
Storm
Follow me at https://social.stormdragon.tk
Back to top
View user's profile Send private message Visit poster's website AIM Address
stormdragon2976



Joined: 19 Nov 2010
Posts: 73
Location: /dev/null

PostPosted: Sat Oct 08, 2011 6:43 pm    Post subject: Reply with quote

There is another thing that #line {gag} isnt doing the way it should. Here is an example:
#MACRO {\e2}
{
#line {gag};
replay 2 | head -2
}
This should replay the second to last message from the message history. For example:
PK arena 'Starry Sky' is now open for a clan war! All players level 35 and below may join now to test their skills.
and it should gag the starting line which is:
Recent channel history
It does this sometimes, but usually it outputs both lines:
Recent channel history
PK arena 'Starry Sky' is now open for a clan war! All players level 35 and below may join now to test their skills.
_________________
Storm
Follow me at https://social.stormdragon.tk
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: Sat Oct 08, 2011 9:03 pm    Post subject: Reply with quote

Could be the MUD is sending something that ends up getting gagged instead.

You could do something like:

Code:

#MACRO {\e2}
{
  #act {^Recent channel history}
  {
    #line gag;
    #unact {^Recent channel history}
  };
  replay 2 | head -2
}
Back to top
View user's profile Send private message Send e-mail
stormdragon2976



Joined: 19 Nov 2010
Posts: 73
Location: /dev/null

PostPosted: Sat Oct 08, 2011 11:25 pm    Post subject: Reply with quote

That did the trick, it's sending something invisible I guess lol.
_________________
Storm
Follow me at https://social.stormdragon.tk
Back to top
View user's profile Send private message Visit poster's website AIM Address
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Mon Oct 10, 2011 9:04 am    Post subject: Reply with quote

Scandum wrote:
My mistake, {<stuff>} is %1 and %* will be %2:

#alias {^{ble|bles|bless}%*} {#showme {Now blessing%%2};c bless%%2}

stormdragon2976 wrote:
I couldn't get it to work. It kept giving me part of the word bless as the argument as in:
now blessingbl or when I moved the argument to %3 now blessingess
I even took the alias out of the action and tried it that way but still got odd things from %0, so I finally did it like this, outside the action as stand alone aliases:
#alias {^{ble|bles|bless}} {#if {"$bless" == "true"} {c bless}} {9}
#alias {^{ble|bles|bless} %1} {#if {"$bless" == "true"} {c bless %1}} {8}


I only recently discovered this myself but whenever you use a {<option1>|<option2>|...|<optionN>} construct in the first argument (trigger) for an #ALIAS or #ACTION whatever is used to match that to is made availible as a %N (numeric) argument to the code in the second argument. IE. for the second case you have above, stormdragon2976, %1 will have been set to either "ble", "bles" or "bless" when the alias is called - your %1 in the trigger argument and in the command should actually be %2 to avoid a clash...

The reason that this is useful is that if you use a wildcard %* in part of a trigger you can investigate in your code what it was that WAS wildcarded to invoke your #ACTION or #ALIAS!
Back to top
View user's profile Send private message
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