|
Aarlot Adept
Joined: 30 Dec 2003 Posts: 226
|
Posted: Fri Apr 01, 2005 6:25 am
Help with a script |
Ok, I have a group spell script that I've been working on, and from what I can see looking at it, it should work perfectly, but for some reason it will sometimes get behind or not fire at all. Here it is below:
Code: |
#CLASS {Group|Group Spells}
#TRIGGER "grouphaste" {(%w) group-says ~'haste~'$} {
#ALARM +.1 {
#VAR groupweave 1
haste %1
}
} "" {disable}
#TRIGGER "groupii" {(%w) group-says ~'ii~'$} {
#ALARM +.1 {
#VAR groupweave 1
invis %1
}
}
#TRIGGER "groupair" {(%w) group-says ~'air~'$} {
#ALARM +.1 {
#VAR groupweave 1
air %1
}
}
#TRIGGER "groupshield" {(%w) group-says ~'shield~'$} {
#ALARM +.1 {
#VAR groupweave 1
shield %1
}
}
#TRIGGER "groupknock" {(%w) group-says ~'knock (%w)~'$} {
#ALARM +.1 {
#VAR groupweave 1
knock %2
}
}
#TRIGGER "grouparmor" {(%w) group-says ~'armor~'$} {
#ALARM +.1 {
#VAR groupweave 1
armor %1
}
}
#TRIGGER "groupheal" {(%w) group-says ~'heal~'$} {
#ALARM +.1 {
#VAR groupweave 1
heal %1
}
}
#TRIGGER "groupfa" {(%w) group-says ~'fa~'$} {
#ALARM +.1 {
#VAR groupweave 1
fa %1
}
}
#TRIGGER "groupdes" {(%w) group-says ~'des (%x)~'$} {
#ALARM +.1 {
#VAR groupweave 0
des %2
}
}
#TRIGGER "groupsust" {(%w) group-says ~'sust~'$} {
#ALARM +.1 {
#VAR groupweave 1
sust %1
}
}
#TRIGGER "groupbless" {(%w) group-says ~'bless~'$} {
#ALARM +.1 {
#VAR groupweave 1
bless %1
}
}
#CLASS 0
#CLASS {Group|Spell Repeat}
#ALIAS clearweaves {
#VAR weaveque {}
#VAR weavequenums {}
#VAR groupwaitinglist {}
}
#ALIAS gweave {
#IF (@groupwaitinglist) {
#FORALL @groupwaitinglist {
#VAR groupweave 1
#EXEC %i
}
}
}
#VAR weaveque {}
#VAR weavequenums {}
#VAR groupweave {0}
#VAR failonce {0}
#VAR groupwaitinglist {}
#ONINPUT "weavecapture" {weave ~'(*)~'(*)} {
#PRIO {
#IF (@groupweave = 1) {
#VAR groupweave 0
#VAR weaveque %additem( "weave ~'%1~'%2", @weaveque)
#VAR weavequenums %additem( "1", @weavequenums)
} {
#VAR groupweave 0
#VAR weaveque %additem( "weave ~'%1~'%2", @weaveque)
#VAR weavequenums %additem( "0", @weavequenums)
}
}
}
#TRIGGER {Ok.} {}
#COND {^(*)$} {
#PRIO {
#IF (%null( %1)) {} {
#IF (%pos( "Your weave begins to warp and crumbles", "%1")) {
#IF (%item( @weavequenums, 1)=1) {
#VAR groupweave 1
#EXEC %item( @weaveque, 1)
#DELN weaveque 1
#DELN weavequenums 1
} {
#DELN weaveque 1
#DELN weavequenums 1
#VAR failonce 0
}
} {
#IF (%ismember( %item( @weaveque, 1), @groupwaitinglist)) {#DELI groupwaitinglist {%item( @weaveque, 1)}}
#DELN weaveque 1
#DELN weavequenums 1
#VAR failonce 0
}
}
}
} {within|param=1}
#TRIGGER {In your dreams, or what~?} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: Sleeping
#VAR failonce 1
}
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
#TRIGGER {Ok~.} {}
#COND {^$} {
#PRIO {
#IF (%ismember( %item( @weaveque, 1), @groupwaitinglist)) {#DELI groupwaitinglist {%item( @weaveque, 1)}}
#DELN weaveque 1
#DELN weavequenums 1
#VAR failonce 0
#IF (%ismember( %item( @weaveque, 1), @groupwaitinglist)) {#DELI groupwaitinglist {%item( @weaveque, 1)}}
}
} {within|param=1}
#TRIGGER {You can't even feel the magical source in this place~!} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: ~!MAGIC
#VAR failonce 1
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
}
#TRIGGER {*tells you ~'My shop has been protected, your magic has no effect here~'.} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: ~!MAGIC
#VAR failonce 1
}
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
#TRIGGER {Nobody here by that name.} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: I cannot see you, or you are not in the same room.
#VAR failonce 1
}
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
#TRIGGER {Nah... You feel too relaxed to do that..} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: Sleeping
#VAR failonce 1
}
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
#TRIGGER {Impossible~! You can't concentrate enough~!} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: Combat
#VAR failonce 1
}
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
#TRIGGER {You can feel the magical source but can't reach it...} {
#PRIO {
#IF (@weaveque) {
#IF (%item( @weavequenums, 1)=1) {
#ADDI groupwaitinglist %item( @weaveque, 1)
#IF (@failonce = 0) {
gs Weave failed~: Stilled!
#VAR failonce 1
}
#DELN weaveque 1
#DELN weavequenums 1
}
}
}
}
#CLASS 0
|
I know it's a little inelegant, and I'm also open to suggestions on how to improve it, but it's what I have for now. Between all the triggers I have there, I cover every possible output for when I attempt a weave. I have the dual variable system going because I don't want it to automatically retry EVERY weave I do, just those asked for by a group member. Unfortunately, this will get behind or not go off at times, with no apparent reason, and at others it will work perfectly. Hopefully someone here will be able to help me debug |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
|
harowen Newbie
Joined: 04 Apr 2005 Posts: 3
|
Posted: Mon Apr 04, 2005 8:50 am |
#TRIGGER "groupbless" {(%w) group-says ~'bless~'$} {
#ALARM +.1 {
#VAR groupweave 1
bless %1
}
I would probably rewrite it to use %push() and %pop() to push and pop the requestor and spellnames from a stack. Also, you should consider consolidating the triggers to a single trigger such as:
{(%w) group-says ~'({haste|ii|air|shield|knock|armor|heal|fa|dest|armor|sust})~'}
%w here becomes %1 and the variable list becomes %2
If you do the {}'d list uses the items separated by the | symbol to check each one as a possble match for the trigger. Including the ()'s on the outside of the {}'s allows the matching result to be passed along as a variable.
So matching your setup you get:
#TRIGGER "grouparmor" {^(%w) group-says ~'({haste|ii|air|shield|knock|armor|heal|fa|dest|armor|sust})~'$}
#ALARM +.1 {
#VAR groupweave 1
%2 %1
}
For security, I generally create a setup that sets a variable array for my groupmembers, then instead of matching against (%w) I match it against ({@mygroup}). The MUD I play on allows abuse of poorly written scripts :)
Hope any of that is useful. |
|
|
|
Aarlot Adept
Joined: 30 Dec 2003 Posts: 226
|
Posted: Mon Apr 04, 2005 11:05 pm |
Hrmm.. thanks for the input, since posting this I've already done the @mygroup thing :) But the other things don't really help with my problem, as far as I can see. I have separate triggers for each of the group spell commands because I want to be able to turn them on/off individually, depending on who I'm grouped with. If several of us in the group have a haste trigger, for instance, we don't want them all going off every time someone group-says haste. And the %push and %pop.... I'll look into those, but I don't think it'll help much with my current problem.
I think I may need to explain exactly what I want to do here. I'm trying to make it so that I have a repeat system that does not try to repeat every weave I do, but only those asked for by a groupmember. And since often I'll often send commands for several weaves at once, as in example below, I need to keep track of them:
weave 'bless' me
weave 'war chant'
weave 'aid' me
Ok.
You feel righteous.
<353H 470M 57V 1X 18:06:43 88S 156E> Ok.
You begin a low, rythmic chanting.
<353H 446M 57V 1X 18:06:45 88S 156E> Ok.
Your weave begins to warp and crumbles!
I need to keep track of which ones failed and whether those that failed were ones that a groupmember asked for, and thus needing to be recast, and on their failure, send the command to try again. |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
|
|
|
|
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
|
|