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

need help with simple script

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
Plague



Joined: 12 Nov 2008
Posts: 24
Location: Latvia

PostPosted: Thu Dec 04, 2008 2:20 am    Post subject: need help with simple script Reply with quote

I'm sorry I think i had to post this on General but anyway..
--------------------------------
When i cast specific spell and it fails I want tintin++ to recast it until it succeds.
Also i'd like it to stop recasting if i get attacked and flee out of room.

For example:
Code:
c 'blind' %1


Possible failure messages (if this happend should recast):
Code:
Nothing seems to happend.
You lost your concentration!


Succes message (stop recasting):
Code:
%1 seems to be blinded!


Message when i get attacked and flee (stop recasting):
Code:
You wimp out, and attempt to flee!

_________________
The Black Death
Back to top
View user's profile Send private message Send e-mail
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Thu Dec 04, 2008 10:10 am    Post subject: Reply with quote

Nope, scripts is the right sub forum. I didn't debug it, but the following ought to work:

Code:

#var cast off

#alias {c '%0' %1}
{
    #regex {%0} {(blind|curse|faerie fire)}
    {
        #var cast {{%0} {%1}};
    };
    #send c '%0' %1
}

#act {%1 seems to be blinded!} {#var cast off}

#act {^Nothing seems to happend.}
{
    #if {"$cast" != "off"} {#send c '$cast[1]' $cast[2]
}

#act {^You lost your concentration!}
{
    #if {"$cast" != "off"} {#send c '$cast[1]' $cast[2]
}

#act {%1 seems to be blinded!}
{
    #var cast off
}

#act {^You wimp out, and attempt to flee!}
{
    #var cast off
}
Back to top
View user's profile Send private message Send e-mail
moebius



Joined: 27 Jan 2005
Posts: 96

PostPosted: Sat Dec 06, 2008 1:35 pm    Post subject: Reply with quote

My alternate solution:

Code:

#action {Nothing seems to happend.} {on_spell_fail}
#action {You lost your concentration!} {on_spell_fail}

#alias on_spell_fail !


I like to use ! for repetitions like this because it is easy to interrupt them if necessary. Of course, the downside is that if you've issued another command since the spell, it will repeat the wrong thing.
_________________
StrangeMUD - strangemud.net:9332
Back to top
View user's profile Send private message
moebius



Joined: 27 Jan 2005
Posts: 96

PostPosted: Sat Dec 06, 2008 1:40 pm    Post subject: Reply with quote

Scandum wrote:
Nope, scripts is the right sub forum. I didn't debug it, but the following ought to work:

Code:
#var cast {{%0} {%1}};


Code:
#if {"$cast" != "off"} {#send c '$cast[1]' $cast[2]}


I didn't know you could index into lists like this, it doesn't seem to be documented.
_________________
StrangeMUD - strangemud.net:9332
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Sat Dec 06, 2008 5:01 pm    Post subject: Reply with quote

moebius wrote:
I didn't know you could index into lists like this, it doesn't seem to be documented.

Now you mention it, I'll add it to the todo list.
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 -> Feature Requests 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