Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
demoneyoungblood
Apprentice


Joined: 16 Dec 2002
Posts: 114
Location: USA

PostPosted: Mon Dec 16, 2002 3:45 am   

Need help with modifying my spellup script
 
ok, here is one of the many scripts im using for spellups on a mud i play...

Pattern: ^~((%w) says~) spell: armor
Value : #IF (@%1forbid=1) {
#VAR %1armor 5
say Now, everyone has you to thank for the penalty of no spells, %1 I was trying to heal. Have fun.
}
#VAR %1armor
#ADD %1armor 1
#IF (@%1armor<4) {c armor %1}
#IF (@%1armor=5) {
say Sorry %1, you are not allowed any more armor spells.
#WAIT 120000
#VAR %1armor 0
say Ok %1, you can now get the armor spell again.
}
#IF (@%1armor=6) {
say You have spammed the Armor spell. Disabling All spells for now.
#t- {spellup shit}
#WAIT 300000
#t+ {spellup shit}
say Spells have been enabled once more.
}


Now, thats just fine and dandy.... aside from the fact that there are 14 or so of these triggers. What I would like to do is find a way of adding the spells to a list, and when a person uses the say spell:spell name it checks that list to make sure its one i can cast....And I would also like to make it so that when a spell misses, it recasts that spell at the target, until it lands..... I need some help please.

+-----------------+
|Demone YoungBlood|
+-----------------+
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Mon Dec 16, 2002 4:41 am   
 
you'll want to use string lists.
you can construct the variables manually, and then you can check them like this
#if (%ismember(%1, @spellsicancast)) {cast %1;lastspell = {%1}} {say i can't cast that}

now, as for recasting on failure, what i would do is keep a variable that has the last spell you tried to cast in it (@lastspell in example above)

#tr {You lost your concentration.} {cast @lastspell}

oh, and you'll need to put the target in there too. if you want more specific help post again and i'll write something more complete
Reply with quote
demoneyoungblood
Apprentice


Joined: 16 Dec 2002
Posts: 114
Location: USA

PostPosted: Mon Dec 16, 2002 5:28 am   
 
ok, how would i setup the string lists to do that, if you have aim, send me a message at demoneyoungblood, would appreciate help greatly

+------------------+
|Demone YoungBlood|
+------------------+
Reply with quote
demoneyoungblood
Apprentice


Joined: 16 Dec 2002
Posts: 114
Location: USA

PostPosted: Mon Dec 16, 2002 6:37 am   
 
ok, ive gotten it almost done, now i need help debugging it, please....

here is the current script:

pattern: ^~((%w) says~) spell: (%*)
value : #IF (%ismember( %1, @forbid)) {
tell %1 You are currently inelligible for my spells at this time.
}
#VAR %1%2
#ADD %1%2 1
#IF (@%1%2<4) {if (%ismember( %2, @castable)) {
cast '%2' %1
lastspell = {%1 '%2'}
} {say I'm Sorry %1, %2 is not a spell in my castable list.}}
#IF (@%1%2=5) {
tell %1 Sorry, you are not allowed any more %2 spells.
#WAIT 120000
#VAR %1%2 0
tell %1 Ok, you can now get the %2 spell again.
}
#IF (@%1%2=6) {
tell %1 You have spammed the %2 spell. Disabling your ability to recieve my spells.
#additem forbid %1
#WAIT 300000
#delitem forbid %1
tell %1 You are now eligible for spells again.
}



Now, its almost done, but its bugging up a bit:
(Paws says) spell: Sleep
Variable PawsSleep not defined
if (0) {cast 'Sleep' Paws;lastspell = {Paws 'Sleep'}} {say I'm Sorry Paws, Sleep is not a spell in my castable list.}


thats what its showing me when the trigger is trying to be used.....help please....

+------------------+
|Demone YoungBlood|
+------------------+
Reply with quote
DevJez
Newbie


Joined: 10 Dec 2002
Posts: 8

PostPosted: Mon Dec 16, 2002 8:01 am   
 
I don't know if I found what your problem was, but I went through it and changed a few syntax things (nothing big, really) and it worked exactly like it should. (say I'm sorry %1, %2 is not a spell in my castable list):



#IF (%ismember( %1, @forbid)) {tell %1 You are currently inelligible for my spells at this time.} {}
#VAR %1%2
#ADD %1%2 1
#IF (@%1%2<4) {
#IF (%ismember( %2, @castable)) {
cast '%2' %1
#VAR lastspell {%1 '%2'}
} {say I'm Sorry %1, %2 is not a spell in my castable list.}
}
#IF (@%1%2=5) {
tell %1 Sorry, you are not allowed any more %2 spells.
#WAIT 120000
#VAR %1%2 0
tell %1 Ok, you can now get the %2 spell again.
}
#IF (@%1%2=6) {
tell %1 You have spammed the %2 spell, Disabling your ability to recieve my spells.
#additem forbid %1
#WAIT 300000
#delitem forbid %1
tell %1 You are now eligible for spells again.
}


Hope that helps ya... if it didn't, catch me on AIM - ReddRider2

Jez
Reply with quote
demoneyoungblood
Apprentice


Joined: 16 Dec 2002
Posts: 114
Location: USA

PostPosted: Mon Dec 16, 2002 6:34 pm   
 
ok.... ive just about given up cuz its still buggyish....
here is the final trigger i came up with, but half the time, it adds the variable, and wont trigger properly...

pattern: ^~((%w) says~) spell: (%*)
value: #IF (%ismember( %1, @forbid)) {
tell %1 You are currently inelligible for my spells at this time.
#VAR %1%2 11
#WAIT 300000
#VAR %1%2 0
} {}
#VAR %1%2
#ADD %1%2 1
#IF (@%1%2<9) {
#IF (%ismember( %2, @castable)) {
cast '%2' %1
#VAR lastspell {'%2' %1}
} {say I'm Sorry %1, %2 is not a spell in my castable list.}}
#IF (@%1%2=10) {
tell %1 Sorry, you are not allowed any more %2 spells.
#WAIT 120000
#VAR %1%2 0
tell %1 Ok, you can now get the %2 spell again.
}
#IF (@%1%2=11) {
tell %1 You have spammed the %2 spell, Disabling your ability to recieve my spells.
#additem forbid %1
#WAIT 300000
#delitem forbid %1
tell %1 You are now eligible for spells again.
}



Its still not working, so maybe one of you guys can rewrite it based on this info:
Spells I am able to cast:
haste
armor
sanctuary
true sight
protection good
farsight
infravision
create food *NOT on a person*
create spring *NOT on a person*
darkblessing
nosferatu protection
renewal
pass door
fly

I think that should be enough info, since you have the old trigger up above too, hehe. Sorry for the length.


+------------------+
|Demone YoungBlood|
+------------------+
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 17, 2002 12:10 am   
 
General Advice
Don't use %*. It's a very easily abused wildcard. Use * instead, it will do
everything you want for this trigger and is much safer.

Don't use #WAIT. It interferes with all processing, not just the current script. Use
#ALARM instead.

Avoid indirect setting names (#VAR %1%2) if at all possible. They are much harder to get
right than almost any other method. (However, I've left them in place)

Do simple scripts first. After they are working, add additional capability. Always
try to keep things as simple as possible.

Specific Advice
With those principles in mind, here's a sample script which will provide similar
reactions:

pattern: ^~((%w) says~) spell: (*)
value: #IF (%ismember( %1, @forbid)) {
tell %1 You are ineligible for my spells at this time. Please wait a few minutes before trying again.
} {}
#VAR %1%2
#ADD %1%2 1
#ALA +120 {#ADD %1%2 -1;#IF ((@%1%2 < 9) AND (%ismember(%1, @forbid) = 0)) {tell %1 You can get another %2 spell now}}
#IF (@%1%2 < 10) {
#IF (%ismember( %2, @castable)) {
cast '%2' %1
#VAR lastspell {'%2' %1}
} {say I'm Sorry %1, %2 is not in my castable list.}}
#IF (@%1%2=10) {
tell %1 Sorry, you are not allowed any more %2 spells. Please wait a few minutes before asking again.
}
#IF ((@%1%2=11) AND (%ismember(%1, @forbid) = 0)) {
tell %1 You have spammed the %2 spell, so I am disabling your ability to receive my spells.
#additem forbid %1
#ALA +300 {#DELITEM forbid %1;tell %1 You are eligible for my spells again. Please don't spam me.}
}

I haven't checked this, there may be typos.

LightBulb
Senior Member
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net