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
g0rd
Newbie


Joined: 01 Sep 2003
Posts: 9
Location: USA

PostPosted: Tue Sep 02, 2003 3:29 am   

#IF question for shop trigger/script
 
I'm trying to make a trigger that will cast a lot of spellups on people who give me 25 gold, but in the case of someone who is in my clan, I would like it to give the gold back since we're not charging them. Here's what I have:

Pattern: %1 gives you 25 gold
Value:
#if "%1" ("destrega"] {give 25 gold %1}
c aid %1
#wait 2900
c sanc %1
etc.......

My problem is with the IF. Destrega is a clan member, so I'm going to have a line with each clan members name in it(unless there is a smoother way to handle this.)

#if "%1" ("destrega") {give 25 gold %1}
^ expression not allowed here

or when I try

#if "%1" "destrega" {give 25 gold %1}
^ command list expected

or even

#if "%1" = "destrega" {give 25 gold %1}
^ syntax error

There must be something simple I can't figure out in the helpfile. More examples in the helpfiles would be nice.

Thanks for any pointers!
John
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Sep 02, 2003 3:40 am   
 
How about basing the script on the asking? In the ask trigger, you can perhaps capture the name, compare it to a list of clanmembers, and determine if you need to ask for the fee.

#trigger {(%w) asks you, "Can I have a spellup?"} {#if (%ismember(%1,@Clanmembers)) {Spellup %1} {#T+ tSpellFee;tell %1 that will be 25 gold}}

#trigger {(%w) gives you 25 gold.} {Spellup %1}

Spellup would be an alias containing all the stuff you need to cast spells.
Reply with quote
g0rd
Newbie


Joined: 01 Sep 2003
Posts: 9
Location: USA

PostPosted: Tue Sep 02, 2003 4:14 am   
 
Well that sounds wonderful. How do I set up the list of clanmembers where it will save? I don't really grog VAR real well. So I could just take all my spellup commands and make an alias called spellup? Would it look the same? I.E.
c aid %1
#wait 2900
c sanc %1

the part that is {Spellup %1} would run the alias, but how does it know that %1 is the person who sent me the tell.

Thanks for the fast response.
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Tue Sep 02, 2003 5:49 pm   
 
You can always add their names to the variable by using the "|" key. Example:

#VAR clanmembers Clanmember1|Clanmember2|Clanmember3

If you do this once and have to go back and add more names, find the variable, left click on the "text" option right above the string list and add them that way.

quote:
how does it know that %1 is the person who sent me the tell.

By enclosing the pattern in parenthesis it saves it into %1..%99.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Sep 02, 2003 10:10 pm   
 
quote:
Originally posted by user0101

You can always add their names to the variable by using the "|" key. Example:

#VAR clanmembers Clanmember1|Clanmember2|Clanmember3

If you do this once and have to go back and add more names, find the variable, left click on the "text" option right above the string list and add them that way.



Actually, you don't really wanna do things this way. If you need to add elements to a stringlist, use #ADDITEM or %additem(). You COULD use #VARIABLE, but then you'd have to take care of whatever else is in the variable to begin with.
Reply with quote
g0rd
Newbie


Joined: 01 Sep 2003
Posts: 9
Location: USA

PostPosted: Tue Sep 02, 2003 10:20 pm   
 
Well I've got it all working, thanks for your help. About adding people to #var clanmember, suppose they sent me a message on clan channel and I wanted it to automatically add them. I'm trying to figure our how to word a trigger to do it.

#trigger (%1 clans 'Addmeplease') #additem %1 @clanmember

or something more correct than this?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Sep 02, 2003 10:53 pm   
 
#TR {(*) clans 'Addmeplease'} {#ADDI clanmember {%1}}

BIG HINT: You can find the correct syntax (what goes where, whether grouping is necessary, and what type of brackets to use for grouping) for every command by using the built-in HELP.

It's true that it takes a few minutes to read one of the help pages. However, it also takes a few minutes to post a question on this forum and you have no control over how long it will take before someone answers or how good their answer will be.
Reply with quote
g0rd
Newbie


Joined: 01 Sep 2003
Posts: 9
Location: USA

PostPosted: Tue Sep 02, 2003 11:41 pm   
 
Thanks. I did read the built in help, but apparently I'm too dumb to understand it. I'll just refrain from asking more questions, since you're obviously bothered by it and or feel like I'm not trying to understand it.

The help I got here was first class, you guys were wonderful. Thanks again.
Reply with quote
Rehcra
Novice


Joined: 10 Oct 2000
Posts: 43

PostPosted: Wed Sep 03, 2003 12:38 am   
 
G0rd, I think you took LightBulb's post in a way he didn't mean it.

He has answered thousands (literally) of questions here. He is a top rate person and understands ZMud ways few others do.

What I think he was trying to say was: Use the Command Wizard help.

Type #add in then command line, and press F1. The Command Wizard, gives you a short help, but more important, it shows you the parameters. You can directly fill in the param's and it will show you the correctly built syntax. This will save you having to come here with the simple questions. And save you the time.

Numerous people will always answer your questions here, what ever they are.

The only thing I think you would ever get flamed for is Zmud for Linux questions. :)
Reply with quote
g0rd
Newbie


Joined: 01 Sep 2003
Posts: 9
Location: USA

PostPosted: Wed Sep 03, 2003 12:44 am   
 
Well if so then my apologies.
Thanks for setting me streight(I hope).
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Wed Sep 03, 2003 1:02 am   
 
The example I gave was for doing it manually in the command bar, not for adding the people to the stringlist via a key-worded tell, or the like. Point being, if it is a small clan you don't need to rely on people to clantell 'addmeplease' at all. For instance, what if people are afk, or don't bother saying the keyword beforehand? The script becomes useless.

And g0rd, LightBulb does come off as belittling to me also, so you are not alone. Whether that is his intent, I don't know. He scripts well so I don't really mind.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Sep 03, 2003 3:35 am   
 
Lightbulb almost never flames anyone, and when he does it's for quite an obvious reason. Usually, though, as long as you're making a reasonable effort he'll just overbore you with details and asking somewhat cutting questions as to your intent ("this and this happens already, so why make things complicated?" types of deals).
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 03, 2003 8:47 am   
 
Thanks Matt. That's pretty accurate.

I certainly didn't mean that you should stop asking questions here, g0rd, and I'm sorry you were offended. Just put my response in that category "you have no control over...how good their answer will be."
Sometimes mine aren't very good.
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