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


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sun Feb 17, 2008 10:31 pm   

will this #IF work?
 
#VAR friends Riona|Mikael|Bser|Tyrant
#IF {@friends {%1=%i} {} {c heal %1}}

Basically, I need it to heal the person only if they are in that variable. I think this might work or atleast be close.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Feb 17, 2008 10:36 pm   
 
Code:
#if %ismember(%1,@friends) {c heal %1} {}

or
Code:
#if (%1 =~ ^{@friends}$) {c heal %1} {}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."

Last edited by Dharkael on Sun Feb 17, 2008 10:48 pm; edited 1 time in total
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sun Feb 17, 2008 10:45 pm   
 
I used to have a working copy of my code. But it's gone. I do know though that it didn't involve an %ismember. Or use a syntax anywhere near yours. But thanks for the input. Always good to learn a few different ways to do the same thing.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Feb 17, 2008 10:53 pm   
 
Always a good time to learn new things :)
Maybe your way was something like this
Code:
#FORALL @friends {#IF (%i=%1) {c heal %1} {}}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sun Feb 17, 2008 10:54 pm   
 
yes, it was forall! Thanks!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Feb 17, 2008 11:41 pm   
 
Remember though that iterating through every single member of the list will probably be much slower than %ismember.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sun Feb 17, 2008 11:43 pm   
 
It's not a speed thing. None of my bots are time restricted. In fact they smoother/slower it is, the better for me. That way I don't upset the creator of the mud with my bot spam.
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Mon Feb 18, 2008 6:57 pm   
 
Another question about the %ismember thingy.

if I make a variable with the ground strings of all the mobs in the mud that I prefer to kill. I could use the %ismember to cross reference it and kill said mob?

like this:
#VAR MANNEUTRALMOBS {A figure enshrouded in a black hooded robe lurks about the temple.}
#if %ismember(%1,@MANNEUTRALMOBS) {bs %1} {}

Would that work? Even remotely efficiently?

Oh and how would I be able to list the other names/insult strings for each mob other than making specific aliases for each.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Feb 18, 2008 7:36 pm   
 
Assuming that your real @MANNEUTRALMOBS rather than this example one actually contains a list, then yes.

However, beware doing it this way - your string %1 must match EXACTLY for this to work. You might want to look at the %match function instead.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Tue Feb 19, 2008 9:49 pm   
 
also in %1 = whatever

if that is user input you can use %proper(%1) and it will work if you panic a caps lock

with triggers I doubt it will ever not be proper case

I do a lot of %lower(%1) in alias and output %proper(%i) too sometimes for neatness, anyway a lot of functions are case sensitive
Reply with quote
Martyl
Newbie


Joined: 30 May 2007
Posts: 7

PostPosted: Mon Apr 14, 2008 9:00 pm   
 
Here's another version, if you wanted to be able to cast when they said or told you a specific spell name (automatically).

( This is based off of something like : Friend says, 'heal' )

#VARIABLE Names {Friend1|Friend2|Friend3} <- my accepted friends list
#VARIABLE Spell_Say {Spell1|Spell2|Spell3} <- my accepted spell say

#TR {^(%w) says, '(*)'} {#IF %ismember(%1,@Names) {#IF %ismember("%2",@Spell_Say) {cast '%2' %1}} {say '%1, you are a loser'}}

So it checks for both variables (in your friends list - Names, and in your spell listing - Spell_Say).

Martyl
Reply with quote
meyn
Beginner


Joined: 06 Mar 2008
Posts: 27

PostPosted: Mon Apr 14, 2008 10:09 pm   
 
youre list of enemys will become time consuming to search through as it gets bigger probably better using triggers , you can even put varoius triggers into diferant clases so you only turn on the group for the ground you xping

Code:
#TR {^A (%w) brown deer eyes you nervously} {
  #VAR temptgt %1
  #VAR tempfleename {deer}
  #VAR dangervalue 2
  #VAR killvalue 3
  #IF (!@roominuse AND @dangervalue <= @alloweddangervalue AND @killvalue >=@ minimumkillvalue) {bestkillvalue} {}
}
#TR {^A young and strong (%w) is here} {
  #VAR temptgt %1
  #VAR tempfleename %1
  #VAR dangervalue 3
  #VAR killvalue 4
  #IF (!@roominuse AND @dangervalue <= @alloweddangervalue AND @killvalue >=@ minimumkillvalue) {bestkillvalue} {}
}
#TR {^A young (%w) begins to thicken with age} {
  #VAR temptgt %1
  #VAR tempfleename %1
  #VAR dangervalue 2
  #VAR killvalue 5
  #IF (!@roominuse AND @dangervalue <= @alloweddangervalue AND @killvalue >=@ minimumkillvalue) {bestkillvalue} {}
}
#TR {^A handsome (%w) stands here} {
  #VAR temptgt %1
  #VAR tempfleename %1
  #VAR dangervalue 5
  #VAR killvalue 6
  #IF (!@roominuse AND @dangervalue <= @alloweddangervalue AND @killvalue >=@ minimumkillvalue) {bestkillvalue} {}
}
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