| View previous topic :: View next topic |
| Author |
Message |
Plague
Joined: 12 Nov 2008 Posts: 24 Location: Latvia
|
Posted: Thu Dec 04, 2008 2:20 am Post subject: need help with simple script |
|
|
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:
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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Thu Dec 04, 2008 10:10 am Post subject: |
|
|
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 |
|
 |
moebius
Joined: 27 Jan 2005 Posts: 96
|
Posted: Sat Dec 06, 2008 1:35 pm Post subject: |
|
|
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 |
|
 |
moebius
Joined: 27 Jan 2005 Posts: 96
|
Posted: Sat Dec 06, 2008 1:40 pm Post subject: |
|
|
| 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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Sat Dec 06, 2008 5:01 pm Post subject: |
|
|
| 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 |
|
 |
|