|
areopagita Newbie
Joined: 02 Dec 2007 Posts: 4
|
Posted: Sun Dec 02, 2007 3:19 pm
I need help with creating autoassist settings |
I am totally new to zmud and without coding experince. So help is greatly apreciated.
Line to trigger assistor:
Nostromo DESTROYS a security robot with his ultimate whip!!!
I have @group variable wich contains several players following leader.
Whenever fight starts, id like to loop the @group variable for a match for Nostromo and others in the list.
If it Nostromo is matched, my avatar should assist Nostromo.
Ive tried #forall @group {assist %i} but this just tries to assist everyone in the list.
I also want exact match for Nostromo whenever hi is attacking, or attacked
(In wich case the line will look like this Bat DESTROYS Nostromo with his ultimate whip!!!).
Thank you. |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Sun Dec 02, 2007 4:12 pm |
Code: |
#va leader {Nostromo}
#trigger {(%w) DESTROYS a security robot with his ultimate whip!!!$} {#if ((%ismember(%1,@leader)) {send message to group to assist Nostromo} {#say %1 isn't Nostromo, don't call assists!}}
#trigger {Bat DESTROYS (%w) with his ultimate whip!!!$} {#if ((%ismember(%1,@leader)) {send message to group to help dying Nostromo} {#say %1 isn't Nostromo, so he can die. We don't care!}}
|
If that aint what you need. Feel free to clarify.
Prog |
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
DaraisDarkwave Beginner
Joined: 09 Nov 2007 Posts: 28 Location: Fairbanks, Alaska
|
Posted: Sun Dec 02, 2007 9:51 pm |
Code: |
#ALIAS assistoff {#var assisting 0;#say auto-assist off}
#ALIAS assiston {#var assisting 1;#say auto-assist enabled}
#CLASS {assist}
#REGEX {(?:DISTENTIGRATES|DISEMBOWELS|ERADICATES|PUMMELS|TOTALLY DEMOLISHES|ANNIHILATES|OBLITERATES|massacres|hits|slashes|whips|misses)} {#if (@assisting > 0) {#PRI {assist;#t- assist}}}
#TRIGGER {^You receive your share of * experience} {#if (@assisting > 0) {#t+ assist}}
#VAR assisting {0}
#CLASS 0 |
Feel free to tell me if that doesn't work.. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 02, 2007 9:56 pm |
It would be easier to have your MUD admin implement an autoassist code, BUT...
Here is what you're looking for:
NOTE: This works with multiword mobile names as well... And with multiword attack messages...
Code: |
#CLASS {AutoAssist}
#ALIAS addatkmsg {#ADDITEM attackmsgs %-1}
#ALIAS delatkmsg {#DELITEM attackmsgs %-2}
#ALIAS addassist {#ADDITEM group %1}
#ALIAS delassist {#DELITEM group %1}
#VAR group {}
#VAR attackmsgs {}
#TRIGGER {(%w) @attackmsgs} {#IF (%ismember( %1, @group) > 0) {assist %1}}
#TRIGGER {@attackmsgs (%w)} {#IF (%ismember( %1, @group) > 0) {assist %1}}
#CLASS 0
|
Though upon testing this doesn't work as suggested in THIS Thread... hmm. I've never tried to use variables as part of the trigger pattern, can someone correct this? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Dec 02, 2007 10:10 pm |
The list variables just need to be surrounded by braces in the pattern.
#TRIGGER {(%w) {@attackmsgs}} {#IF (%ismember( %1, @group) > 0) {assist %1}}
#TRIGGER {{@attackmsgs} (%w)} {#IF (%ismember( %1, @group) > 0) {assist %1}} |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 02, 2007 10:49 pm |
Thanks Vij :)
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
areopagita Newbie
Joined: 02 Dec 2007 Posts: 4
|
Posted: Mon Dec 03, 2007 5:18 pm |
Thank you.
Havent tested yet, but i am sure that these stuff will serve well for my purpose.
Id like also to set button, wich opens up #var group for editin.
This is not too important, because i already have alias for it. Also for checking.
#al gset {#additem group %1;#additem group %2;etc...} |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Dec 03, 2007 5:50 pm |
areopagita wrote: |
#al gset {#additem group %1;#additem group %2;etc...}
|
Why not do this instead:
Code: |
#ALIAS gset {#var tempstr %-1;%subchar(@tempstr, " ", "|");#while (%ismember(@tempstr) > 0) {#ADDITEM group %item(@tempstr, 1);#DELNITEM tempstr 1}}
|
It is far more efficient, and can accept any number of names passed to gset. |
|
|
|
areopagita Newbie
Joined: 02 Dec 2007 Posts: 4
|
Posted: Tue Dec 04, 2007 2:15 am |
Hmm.
There is a broblem.
While i have this trigger
#TRIGGER {{@attackmsgs} (%w)} {#IF (%ismember( %1, @group) > 0) {assist %1}}
For some reason it produces a loop.
Looks like it reacts on everyting.
If @group is Nostromo
it reacts on "sfsfsf Nostromo" and triggers loop.
If it is for example;
#TRIGGER {{@attackmsgs} (%w)} {#IF (%ismember( %1, @group) > 0) {#say hello}}
it works, but when i type "sfsf Nostromo" it also works.
What is wrong?? |
|
|
|
areopagita Newbie
Joined: 02 Dec 2007 Posts: 4
|
Posted: Tue Dec 04, 2007 2:20 am |
Bah.
It was my mistake.
I replaced @attackmsgs with @atmsg, but forgot to put it in trigger (noob).
Now it works perfectly.
Thanks a lot! |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Dec 04, 2007 2:43 am |
I would suggest at least atkmsg. I try to be very descriptive in naming my variables. Comes from 14 years of programming computers and learning it is MUCH easier to recall what it is for when it has a descriptive name.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|