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: Sat Jul 14, 2007 7:01 pm   

another newbie problem with this darned zscripting
 
Here's the script I'm trying to use. Really simple and versatile for me. But I can't get the danged @friend variable to work.

Code:
#CLASS {RionaBot}
#ALIAS heal1 {c heal}
#ALIAS heal2 {c heal @friend}
#ALIAS sanc1 {c sanc}
#ALIAS sanc2 {c sanc @friend}
#ALIAS armor1 {c ar}
#ALIAS armor2 {c ar @friend}
#ALIAS displace1 {c displ}
#ALIAS displace2 {c displ @friend}
#ALIAS invis1 {c invis}
#ALIAS invis2 {c invis @friend}
#ALIAS bless1 {c bless}
#ALIAS bless2 {c bless @friend}
#ALIAS strength {
  c str
  c str
  c str
  }
#ALIAS dex {
  c dex
  c dex
  c dex
  c dex
  }
#VAR CommandList {recall|regen|sleep|wake|fight|atk|bk|assist|flee|retreat|sit|heal1|heal2|area|sanc1|sanc2|invis1|invis2|armor1|armor2|shield|displace1|displace2|strength|dex|bless1|bless2}
#VAR friend {Riona|Keiser|Bser|Omi|Tyrant|Mexx|Janus}
#TRIGGER {^@friend tells the group, 'way %1'} {way %1}
#TRIGGER {^@friend tells the group, 'bs %1'} {bs %1}
#TRIGGER {^@friend tells the group, '/ %1'} {@CommandList}
#CLASS 0
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 14, 2007 7:27 pm   
 
I don't even see where you define the "friend" variable. If you don't have the friend variable defined, then it won't work. Also, proper casing might be part of the problem. If you -do- have the friend variable defined, and it's lowercase but the MUD sends uppercase, then it won't match. Variables are funny like that - they have to match -exactly- as they are in the string. An easy thing to do is change your trigger to read "#TRIGGER {^%1 tells the group, 'way %1'} {#IF ismember(%lower(%1), @friend) {way %1}}" and see if that works. It'll automatically lowercase the friend name to match anything you have in the variable.

However, this does sound largely like a bot, and you may want to make sure you're not going to get removed from the MUD for using such a bot. *shrug* Just some warning. I warned you once. :P

Charneus

*EDIT* I see where it was defined. All capital. Missed that. In that case, use:

#TRIGGER {^(%w) tells the group, 'way %2'} {#IF ismember(%1, @friend) {way %2}}

Still my warning stands.
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Jul 14, 2007 8:40 pm   
 
Thanks for your warning. But this is for when my kids need my attention. I have two kids, so sometimes I'm gone for a bit. This is never going to be used for prolonged amounts of time.

Where do I insert this line?
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Jul 15, 2007 1:37 pm   
 
He is not saying that this one trigger will fix the whole thing. He is showing you a way to check the friend variable so it will work for that one trigger.
Then you can fix them all to work in the same fashion.

#TRIGGER {^@friend tells the group, 'way %1'} {way %1}

Becomes

#TRIGGER {^(%w) tells the group, 'way %2'} {#IF ismember(%1, @friend) {way %2}}

Another and I would think easier way to do the same thing is this.

#TRIGGER {^{@friend} tells the group, 'way %1'} {way %1}


A mention about using %n in trigger patterns. %1 as you used it above is not meant to be used in the pattern of the trigger. One could almost call it a bug that it works.

You see the way charneus used %w in his example? %w is a wildcard that matches abcABC a block of text containing letters but no spaces or special characters.
There is a whole section about wildcards here Match in the help files.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Mon Jul 16, 2007 1:09 am   
 
Well, I changed those lines and the way one works. the others don't. and when a friend tries the command....we'll you'll see

Code:

<785hp 270m 405mv>
Riona tells the group, '/ sleep'
recall|regen|sleep|wake|fight|atk|bk|assist|flee|retreat|sit|heal1|heal2|area|sanc1|sanc2|invis1|invis2|armor1|armor2|shield|displace1|displace2|strength|dex|bless1|bless2

<785hp 270m 405mv>
(sorry, filter 'regen' does not exist.  Bailing out)

<785hp 270m 405mv>
(auction) Current bid is 100 gold coins for 'Tensor's floating disc'.

<785hp 270m 405mv>
Riona tells the group, '/ regen'
recall|regen|sleep|wake|fight|atk|bk|assist|flee|retreat|sit|heal1|heal2|area|sanc1|sanc2|invis1|invis2|armor1|armor2|shield|displace1|displace2|strength|dex|bless1|bless2

<785hp 271m 405mv>
(sorry, filter 'regen' does not exist.  Bailing out)

Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Jul 16, 2007 1:25 am   
 
#TRIGGER {^@friend tells the group, '/ ({@CommandList})'} {#EXECUTE %1}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Mon Jul 16, 2007 1:39 am   
 
that worked, thanks!
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