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
Kyote
Novice


Joined: 13 Jan 2002
Posts: 36
Location: USA

PostPosted: Sun Jan 13, 2002 11:35 pm   

String list???
 
I'm not sure thats what it's called or not. But I'd really appreciate some help understanding this. As an example I want to make an alias to cast my protective spells on me:
cast armor
cast shield
cast sanctuary
cast 'protection good'
How would I do this using a string list??? Also, is there a way I can monitor losing my concentration and failing to cast the spell successfully and make it cast only the failed spells again? I know this is possible but I seem to misunderstand or something...

---------------------
Kyote

Happiness isn't a destination. It's a way of life!!! In other words... Don't live until you can be happy... Be happy while you live!!!!
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Jan 14, 2002 2:27 am   
 
You can try something like this:

#var list {armor|shield|sanctuary|protection good}

#alias spellup {#t+ Spellup;#var templist @list;castcurr}

#alias castcurr {#var currspell %item(@templist, 1);cast '@currspell'} "Spellup"

#trigger {^You lost your concentration!} {cast '@currspell'} "Spellup"

#trigger {^You cast {@list}} {#delitem templist @currspell;#if (@templist) {castcurr} {#say SpellUp Done!;#t- Spellup}} "Spellup"

Untested code, so I might be missing a curly brace or something.

Iljhar
Reply with quote
Kyote
Novice


Joined: 13 Jan 2002
Posts: 36
Location: USA

PostPosted: Mon Jan 14, 2002 3:52 am   
 
quote:

You can try something like this:

#var list {armor|shield|sanctuary|protection good}

#alias spellup {#t+ Spellup;#var templist @list;castcurr}

#alias castcurr {#var currspell %item(@templist, 1);cast '@currspell'} "Spellup"

#trigger {^You lost your concentration!} {cast '@currspell'} "Spellup"

#trigger {^You cast {@list}} {#delitem templist @currspell;#if (@templist) {castcurr} {#say SpellUp Done!;#t- Spellup}} "Spellup"

Untested code, so I might be missing a curly brace or something.

Iljhar


Okay... this is something that stumps me.... Could someone explain to me the first line of this script, and what it does? I want to understand so I don't have to keep asking for help, but this is one part of zmud I seem to be unable to understand from zmud's help file..

---------------------
Kyote

Happiness isn't a destination. It's a way of life!!! In other words... Don't live until you can be happy... Be happy while you live!!!!
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jan 14, 2002 2:48 pm   
 
You mean this one?:
#VAR list {armor|shield|sanctuary|protection good}

What this does is create a variable @list. The variable will contain a stringlist with 4 strings in it:
  • armor

  • shield

  • sanctuary

  • protection good


Each string in the list must be separated by a pipe (|) and the wole list is enclosed in curly braces so zMUD knows what is supposed to be the list and doesn't intepret part of the list as other arguments to the #VAR command.

Kjata
Reply with quote
Kyote
Novice


Joined: 13 Jan 2002
Posts: 36
Location: USA

PostPosted: Mon Jan 14, 2002 8:22 pm   
 
Okay, this script works, for the most part. But it only casts the first spell and then stops. How can I loop it through and make it continue with the next spell? Do I need to have it watch for text before going onto the next, and if so, how do I make it continue?
Thank you Iljhar for your help!!! It's really appreciated.

And thank you too Kjata. Yes, that was the line I am having trouble with. Okay, I think I understand the string list a bit better.


---------------------
Kyote

Happiness isn't a destination. It's a way of life!!! In other words... Don't live until you can be happy... Be happy while you live!!!!
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jan 14, 2002 8:47 pm   
 
Did you modify the pattern of the last trigger so it matches with each of the succesful messages of the spells in the list?

Kjata
Reply with quote
Kyote
Novice


Joined: 13 Jan 2002
Posts: 36
Location: USA

PostPosted: Tue Jan 15, 2002 8:31 am   
 
Duh... Sometimes I can be very dense. Thanks Kjata, that did the trick. I have been inserting triggers for each successful casting and adding the following as the commands for the trigger

#delitem templist @currspell
#if (@templist) {castcurr} {
#say SpellUp Done!
#t- Spellup
}

and it now works fabulously. Thank you all for the help. I also looked up #delitem and now understand a little better as well whats going on. Thanks for all the help.

---------------------
Kyote

Happiness isn't a destination. It's a way of life!!! In other words... Don't live until you can be happy... Be happy while you live!!!!
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