 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Mon Jan 07, 2008 8:00 pm
#when? |
Greetings everyone
I am new at Zmud and I have some troubles putting up my defences.
I know about the #if, but I should need a command which puts up an alias WHEN I have a variable go 1.
I'll give a straight example :
grip
fitness
lv
#if (@balance and @equilibrium) {
#alarm {+3.8} {shr}
#alarm {+2} {ds}
}
I have a button (called Basic Defences) and when I push it, it triggers that command :
grip
fitness
lv
--> Those commands take both balance and equilibrium away, I have a trigger constantly knowing when it goes away and comes back<--
Now I'm in trouble, I want to trigger shr (shroud) and ds (deathsight) when I have recovered both balance and equilibrium.
I heard about ToDo but it doesn't seem to work, anyone has a further idea?
It would be nice if we could have a #when command put in so I could solve my problem easily
Thank you for your time! |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jan 07, 2008 8:19 pm |
zMUD's feature complete, but CMUD has a #waitfor command that does what you're after.
You can do this kind of thing in zMUD with a multistate trigger, or with a priority queue. Multistate trigger is easiest for stuff you're always going to do in the same order, like defences:
#alias defup {doDef1;#t+ defs}
#trig "defs" {You have recovered balance.} {doDef2} "" {disable}
#cond {You have recovered balance.} {doDef3;#t- defs} |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Tue Jan 08, 2008 7:05 pm |
Alright, that have me a start but it still doesn't work.
So this is what I got :
#alias basicdefs {grip;fitness;lv;#t+ deathsight}
#trigger deathsight {#cond {^You have recovered equilibrium\.$} {ds;#T+ shroud}
#trigger shroud {#cond {^You have recovered balance\.$} {shr}
This is it.
I checked the perl regex box and I know the condition lines are correct, what to do? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jan 08, 2008 7:11 pm |
Compare your code to mine and you'll notice the difference. My #cond command is on its own line, and isn't part of the #trig command. The #cond command adds a trigger state to the previous trigger, in my case the "defs" trigger. In your case, this'll result in many trigger states being created all over the place. You've also opened a brace { but not closed it.
I have a single trigger to handle all my defs, rather than many as you have. The idea is that you add as many states using the #cond command as you need to, with each performing a separate defence. The last one will disable the defs trigger. |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Tue Jan 08, 2008 8:19 pm |
I just don't get it...
When I try to code in CLASS SCRIPT, it deletes everything when I try to save it and I don't get it when I try to do it normal... I have a trigger called defs but where do I write : You have recovered balance? In the Value? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jan 08, 2008 8:43 pm |
If your syntax is invalid (as yours is - like I said, it has unmatched braces) then the class script will revert to its old contents when you try to save it.
You can create your multistate trigger manually if you want. The "You have recovered balance" is the pattern, and as such goes in the pattern box. Whatever script you want to run is the value. If you select the states tab and then double-click on the second line, the red icon will move down to highlight it. You now have the second state selected and can fill that in as I have above (I used the #cond command to create the second state). |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Wed Jan 09, 2008 4:03 pm |
Alright, I'm a step further again. But it's still doesn't fire as I want it to...
I have an alias basicdefs with in the value :
grip
fitness
#T+ "defs"
Then I have a trigger called : defs
http://i28.photobucket.com/albums/c216/Heluris/test.jpg
This is what is in my states, the problem is : After grip and fitness, it stops... Doesn't respond anymore |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jan 09, 2008 4:52 pm |
Your problem is that the trigger pattern needs to be whatever you want it to fire on, and the trigger NAMED defs. You've got it as pattern defs.
Under the options tab in the ID box is where it should say defs at, that is the NAME of the trigger. |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Wed Jan 09, 2008 8:33 pm |
Alright, I filled in that too now. But it still doesn't work...
http://s28.photobucket.com/albums/c216/Heluris/?action=view¤t=Test-1.jpg
Alright, the first trigger triggers, good! Now my next trigger will trigger when the new line from the Mud comes, the new line comes and it doesn't work again...
I have to say I have another trigger : You have recovered equilibrium with another value, does it matter? |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jan 09, 2008 9:02 pm |
Ok, I don't see your second pattern of recovering equilibrium, thats why second trigger never fired.
|
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Wed Jan 09, 2008 9:21 pm |
I don't get it, I do have a pattern : You have recovered equilibrium
No it's because : +-----------------------+
You have equilibrium
+-----------------------+
is that line : You have equilibrium, which I changed with an other trigger, is that the problem? |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Thu Jan 10, 2008 8:12 pm |
Alright! Update.
The problem is indeed I have another trigger 'You have recovered equilibrium.'
The system triggers that trigger instead of my multi-state one.
EDIT : Alright, I moved those triggers into my multi-state trigger, but now I have the problem that when it is triggered, I don't see my nice and shiny equilibrium anymore because it is already triggered...
So how do you (like in my example) NOT let something trigger in a multi-state trigger. That would solve the problem |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Thu Jan 10, 2008 8:42 pm |
Hmm, I guess I don't get what you're saying ;)
Can you export the current trigger to text, and then past the contents of that file here with [ code ] [ /code ] (without spaces) tags surrounding it?
Then perhaps another photo of exactly what you're trying to trigger on in each of the 3 states. |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
|
|
 |
ShadowsPirate Beginner
Joined: 15 Jun 2007 Posts: 17
|
Posted: Sat Jan 12, 2008 1:43 am |
In the picture, in your code, you have your if statement....but all its doing is "if @variable and @variable and @variable" etc, but not checking it against anything. I believe it thinks, "if 1 and 1 and 1 and 1"...
Sorry if I'm way off, , just trying to help. |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jan 12, 2008 7:53 am |
Actually, ShadowsPirate, it's possible for variables to contain values that evaluate to false - 0 is one such value. The following, for example:
#var test 0
#if (@test) {#say yes} {#say no}
will print "no". |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Sat Jan 12, 2008 5:58 pm |
It's not that which is the problem, it's that shiny trigger
edit :
Alright, I just made another trigger and solved the problem. But as I continue, another problem rises :
http://i28.photobucket.com/albums/c216/Heluris/Trouble2.jpg
I want my shiny equilibrium trigger! I think the only problem can be located in the fact that the small = ain't green |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Sun Feb 24, 2008 4:32 pm |
Greetings everybody!
I come to you with another (probably) easy question.
Here we go :
I want a macro (F2) that flings tarot at myself OR at my target (@target)
So I have a variable (switchtarot) and I made a macro with these commands :
#if switchtarot=@target {
switchtarot=self
#sa
#sa Pearl : Flinging Tarot at self
#co cornflowerblue
} {
switchtarot=@target
#sa
#sa Pearl : Flinging Tarot at @target
#co cornflowerblue
}
The strange part is : When my variable switchtarot has the value self, it works (it switches to my target).
But when switchtarot has the value of @target (which is rat in my case right now), it doesn't switch to self!
Any suggestions?
Oh PS : I always have to use 2 times #sa because otherwise the message is displayed next to my promt, which I don't want. |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sun Feb 24, 2008 5:00 pm |
#if switchtarot=@target {
Firstly your syntax is slightly wrong as if structure should be like this.
#if (condition in parenthesis) {True stuff happens if condition is true.} {False stuff happens if condition is false.}
Secondly you are setting switchtarot to the value of @target or so the if statement thinks you are doing, or at least it isn't sure what you are doing so it is guessing.
#if (@switchtarot=@target) {
or even better
#if (@switchtarot==@target) {
Make it more clear to Zmud that you are wanting to compare the values instead of setting switchtarot to the value of @target.
Yes the if can sometimes tell without the () and sometimes even if you use {} instead of the () but it is always best to make your if conditions as clear as possible. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Sun Feb 24, 2008 5:57 pm |
Thanks you! It works flawless, but why should == be better then = ?
|
|
|
 |
Leitia Adept

Joined: 04 May 2007 Posts: 292 Location: Boston
|
Posted: Sun Feb 24, 2008 10:31 pm |
Funny thing happened with balance recovery, I began to find other peoples vials in my backpack!
I made a ToDo list for “generosity|put 50 vial in pack“, but the second command would not fire if I was already generous. Later, as I tried to return vials after filling them, I recovered balance. Then the ToDo put 50 vials in my pack, but they were not MY vials. Finally someone asked why I was stealing his vials, mystery solved, but it took me a bit to find out why. |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Sat Mar 15, 2008 11:34 am |
Greetings everyone!
Another very small question I have, I now know about most of the % commands, but the only one I can't find explanation for is %i. What does it do/ mean? |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Sat Mar 15, 2008 12:25 pm |
I'll just post the big part, because I can't get out , I want to use a new system for curing my afflictions, instead of using : #if @goldenseal {egol},...
I now have a variable called afflictions
fe. : ^You flip the bird\.$ {p_afflicted stupidity}
p_afflicted is an alias with value :
#additem afflicted %1
#forall %db( @herb_cures , %1)
#sa %ansi( cyan) +~[Pearl~]+: %ansi( red)%expand( %-1)
herb_cures is a datalist where stupidity should trigger the command egol (outr goldenseal, eat goldenseal). But when I flip the bird for example, it says : +Pearl+ : Stupidity and it doesn't heal it at all!
Any help? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Mar 15, 2008 5:36 pm |
%i is the iterator variable for #loop and #forall. In loop, it contains the number of times it's looped. In forall, it contains the current item of the list. Try it - #loop 25 {#say loop number: %i} and #forall Fang|is|the|best {#say %i}
Your #forall syntax is wrong in this case, anyway - check the help. Your @herb_cures variable is not a stringlist, so you shouldn't be using #forall with it anyway. What I imagine you want is: #exec {%db(@herb_cures,%1)}.
Having said that, how is the data structured in @herb_cures? I'm assuming here that the value for stupidity will be "outr goldenseal;eat goldenseal" but if it's a stringlist "outr goldenseal|eat goldenseal" you'd need to use forall like this:
#forall %db(@herb_cures,%1) {#exec %i} |
|
|
 |
Arzoc Beginner
Joined: 07 Jan 2008 Posts: 18
|
Posted: Sun Mar 16, 2008 7:26 am |
Paralysis=eblo|Stupidity=egol
egol is an alias : outr goldenseal, eat goldenseal.
I thank you for helping me, I got it to work but what I actually want to achieve is that it somehow tracks my affliction variable and whenever I am afflicted with something (which appears in my affliction variable), it goes to my database (herb_cures) and heals it.
This is what I have :
#additem afflicted %1
#if (@afflicted %1 and @awake and @stunned=0 and @plantallowance) {#exec %db( @herb_cures , %1)}
It works, but the problem is that it is dependant of the %1, so it only checks it once... How can I let it check @afflictions all the time? |
|
|
 |
|
|