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

How To Call a Wildcard

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Fri Jan 11, 2008 3:39 pm    Post subject: How To Call a Wildcard Reply with quote

I'm not the most brilliant but for the life of me I can't figure out how to call a wildcard, here's what i'm trying to do: I want to make a tell bot so if i get thie %1 tells you, 'Send %2 <message>.' then i reply ok and create an action that says if %2 logs on send %2 the message so i was trying this out, but i can't figure it out so should i try this?:

#act {%1 tells you, 'Send %2 *.'} {tell %1 ok I'll tell %2 you said *;#act {[INFO] %2} {tell %2 %1 wanted me to tell you *;#delay 2 #unact {[INFO] %2}}

Or does the wildcard need to be encased in {}'s? how do I call it?
Back to top
View user's profile Send private message
titeuf



Joined: 29 Jul 2006
Posts: 84

PostPosted: Fri Jan 11, 2008 7:47 pm    Post subject: Reply with quote

You should use %3 instead of the wildcard, as tt matches everything, including spaces.

So it'll become:
Code:

#act {%1 tells you, 'Send %2 %3.'} {
   tell %1 ok I'll tell %2 you said %3;
   #act {[INFO] %2} {
      tell %2 %1 wanted me to tell you %3;
      #unact {[INFO] %2}
   }
}


also took out the delay as that's not really needed here I think, you only want to send that tell one time to that person and then remove that trigger right?
Back to top
View user's profile Send private message
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Sat Jan 12, 2008 1:17 pm    Post subject: Reply with quote

Thank you, that did solve the problem, i thought the variable might only be able to handle one word, However, not in this case but is it possible to call a wildcard? Now i run into the problem of whether they capitalize the name or not because the MUD gives me [INFO] <Name> has returned to <mudname> so the name is capitalized but the bot doesn't compensate for the capital in the message because they said Send <name> message so is there a way around that?, I tought about making a variable for the first letter of the name of the person but some people do change their first letters so how can tt++ compensate for capitalization errors?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Jan 12, 2008 4:04 pm    Post subject: Reply with quote

It's never too late to pull out the big guns Coffee

Code:

#act {%1 tells you, 'Send %2 %3.'}
{
        tell %1 ok I'll tell %2 you said %3;

        addmessage %1 %2 %3
}

#function {lowercase}
{
        #format {result} {%l} {{%0}}
}

#alias {addmessage %0 %1 %2}
{
        #list messagefrom ins -1 %0;
        #list messagename ins -1 @lowercase{%1};
        #list messagedesc ins -1 %2
}

#alias {delmessage %0}
{
        #list messagefrom del %0;
        #list messagename del %0;
        #list messagedesc del %0
}

#alias {checkmessage %0}
{
        #list messagename fnd {@lowercase{%0}} index;

        #if {$index != 0}
        {
                tell $messagename[$index] $messagefrom[$index] wanted me to tell you $messagedesc[$index];
                delmessage $index;
                #delay 0 checkmessage %0
        }
}

#act {^[INFO] %0 has returned to} {checkmessage %0}
Back to top
View user's profile Send private message Send e-mail
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Sat Jan 12, 2008 7:50 pm    Post subject: Reply with quote

i'm getting this error

#MATH EXP: INVALID INPUT {$index}
#MATH EXP: INVALID INPUT {$index}

also it was setting half the code as the value after the tell %1 %2 %3 because of an } that didn't belong i believe, any suggestions?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Jan 13, 2008 6:57 am    Post subject: Reply with quote

I made a few edits to the script since I posted it so make sure you have the final edit, also make sure you are running the latest tintin version, 1.97.8.
Back to top
View user's profile Send private message Send e-mail
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Sun Jan 13, 2008 12:04 pm    Post subject: Reply with quote

could the problem be in that i'm running wintin++? i'm getting this

#OK. {%1 tells you, 'Send %2 %3.'} NOW TRIGGERS { tell %1 ok I'll tell %2 you said %3; addmessage %1 %2 %3 } @ <--- NOTICE HERE
{#function{lowercase} { #format {result} {%l} {{%0}} } #alias {addmessage %0 %1 %2} { #list messagefrom ins -1 %0; #list
messagename ins -1 @lowercase{%1}; #list messagedesc ins -1 %2 } #alias {delmessage %0} { #list messagefrom del %0; #list
messagename del %0; #list messagedesc del %0 } #alias {checkmessage %0} { #list messagename fnd {@lowercase{%0}} index; #if
{$index != 0} { tell $messagename[$index] $messagefrom[$index] wanted me to tell you $messagedesc[$index]; delmessage $index;
#delay 0 checkmessage %0 } } #act {^[INFO] %0 has returned to} {checkmessage %0}}

do i need to remove that } or does it stay?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Jan 13, 2008 3:13 pm    Post subject: Reply with quote

The script as posted is fine.

You could check if there are leading and tailing spaces, might be a copy/paste issue.

You're using #read right?
Back to top
View user's profile Send private message Send e-mail
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Sun Jan 13, 2008 4:11 pm    Post subject: Reply with quote

I'm sorry, you're correct the script works excellently, thank you very much
Back to top
View user's profile Send private message
Tyler



Joined: 11 Jan 2008
Posts: 47

PostPosted: Thu Jan 24, 2008 9:48 am    Post subject: Tellbot banlist Reply with quote

Ok so taking the script you posted helped me a lot, thank you very much, I expanded on the code you wrote because players were just generally using the bot for stupid reasons, for instance i'd get someone trying to make me tell myself things, and i'd get someone trying to use the ; to make me do various things, and lastly i'd get people just using me to annoy other players, now I didn't want to put a limit on how many messages you could send so I made a banlist which works great, now my problem is that one alias doesn't work, (remban) for some reason is giving me loads of trouble

Code:

#act {%1 tells you, 'Tell %2 %3}
{
#format {result} {%l} {{%1}};
#list banlist fnd %1 bindex;
#if {
$bindex != 0
}
{tell %1 I'm sorry but you have been put on a banlist, and cannot utilize tellbot at this time, to rectify the problem, please talk to me when I'm online;#return {}
}
{
tell %1 ok I'll tell %2 you said: "%3";
addmessage %1 %2 %3;
#format {result} {%l} {{%1}};
#list banlist fnd %2 bindex;
#if {
$bindex != 0
}
tell %1 NOTE: The person which you are talking to cannot send back a message using Tellbot because they are on a banlist

}

#act {%1 tells you, 'Send %2 %3}
{
#format {result} {%l} {{%1}};
#list banlist fnd %1 bindex;
#if {
$bindex != 0
}
{tell %1 I'm sorry but you have been put on a banlist, and cannot utilize tellbot at this time, to rectify the problem, please talk to me when I'm online;#return {}
}
{
tell %1 ok I'll tell %2 you said: "%3";
addmessage %1 %2 %3;
#format {result} {%l} {{%1}};
#list banlist fnd %2 bindex;
#if {
$bindex != 0
}
tell %1 NOTE: The person which you are talking to cannot send back a message using Tellbot because they are on a banlist

}


#alias {
tellbot
}
{
#sess gw godwars2.com 3000;load tellbot <temporarily removed>
}


#function {lowercase}
{
#format {result} {%l} {{%0}}
}

#alias {addban %0}
{
#list banlist ins -1 @lowercase{%0};
}

#alias {remban %0}
{
#list banlist del %0
}

#alias {addmessage %0 %1 %2}
{
#list messagefrom ins -1 %0;
#list messagename ins -1 @lowercase{%1};
#list messagedesc ins -1 %2
}

#alias {delmessage %0}
{
#list messagefrom del %0;
#list messagename del %0;
#list messagedesc del %0
}

#alias {checkmessage %0}
{
#list messagename fnd {@lowercase{%0}} index;

#if {$index != 0}
{
tell $messagename[$index] $messagefrom[$index] wanted me to tell you $messagedesc[$index];
delmessage $index;
#delay 0 checkmessage %0
}
}

#act {^[INFO] %0 has returned to} {checkmessage %0}




What am I doing wrong for remban?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Jan 24, 2008 5:55 pm    Post subject: Reply with quote

You'd probably want to use:

Code:

#alias {remban %0}
{
    #list banlist fnd %0 result;
    #list banlist del $result
}
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 -> General Discussion 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