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
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Mon Dec 19, 2005 9:36 pm   

Triggering a variable
 
Ok here is the lowdown.

Mud:Realms of Despair SMAUG
Client:zmud 7.20b

Example of what I want triggered:
Body location example.
(the Breastplate of the Ravager gets damaged)

What I have:
All my eq locations are stored in variables. Here is an example of the body location.

#TR {^~(@body gets damaged~)$} {#AD BodyDam 1
#IF (@BodyDam=14) {
remove @body
#ECHO @body %window has 1 ac remaining and has been REMOVED!!!
} {}}


For some reason this fires intermitently and most of the time not at all.
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Dec 19, 2005 10:24 pm   
 
Can you post an example of what exactly is in the @body variable along with more sample output? Often times when triggers don't fire is because the trigger is close but doesn't quite match or only matches a few cases. For example by using the '^' you are requiring that the text always comes at the beginning fo the line which may or may not be the case for RoD
_________________
Asati di tempari!
Reply with quote
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Mon Dec 19, 2005 10:31 pm   
 
the body variable contains the Breastplate of the Ravager
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Dec 20, 2005 4:30 am   
 
Thanks for posting the variable contents.. can you post more mud output? Perhaps the entire output of a short battle.
_________________
Asati di tempari!
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Tue Dec 20, 2005 7:08 am   
 
Have you tried it without the ^ and $ anchors?
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Tue Dec 20, 2005 4:24 pm   
 
Yes I have tried it without the ^$ anchors and still have the same problem.

Ok here is an example of a fight where damage is recieved.

<1144/1403hp 590/616mv 1,016,875g 451wgt><><|><some cuts (71-80%)>

Sir Mordred's slice cuts you!
Sir Mordred's slice cuts you!
Sir Mordred's slice cuts you!
The sky darkens as Sir Mordred calls forth a storm.
Sir Mordred utters the words, 'qarr diesilla'.
Sir Mordred calls God's lightning to strike his foes!
Sir Mordred's lightning bolt jolts you!
Sir Mordred's lightning bolt grazes you.
Sir Mordred's lightning bolt scratches you.
Sir Mordred's lightning bolt grazes you.
(the Breastplate of the Ravager gets damaged)

<1092/1403hp 587/616mv 1,016,875g 451wgt><><|><some cuts (71-80%)>
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 20, 2005 8:54 pm   
 
Try replacing the ^ and $ with %q? My guess is that you have some whitespace on the line, and %q should match that as well as the beginning/end of the line.
_________________
EDIT: I didn't like my old signature
Reply with quote
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Wed Dec 21, 2005 5:27 pm   
 
Replacing the ^ and $ with %q didn't fix the problem either.

The text to be triggered is showed just as it is recieved in the post above MattLofton's. I am beginning to think this will have to be done another way since it works intermitently causing me to believe it's probably the clients interpreter failing to capture properly and not the script. Sad
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!

Last edited by nibbledeuce on Sun Dec 25, 2005 2:30 am; edited 1 time in total
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: Thu Dec 22, 2005 1:19 am   
 
Here is the answer:

#TRIGGER {^~(&body gets damaged~)$} {
#ADD BodyDam 1
#IF (@BodyDam=14) {
remove @body
#ECHO @body %window has 1 ac remaining and has been REMOVED!!!
} {}}

I should also suggest setting the BodyDam variable back to 0 either in this trigger or during another. Otherwise, it will only execute once and you'll end up resetting the variable manually. That can be done with:
#VAR BodyDam 0
Reply with quote
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Thu Dec 22, 2005 7:34 am   
 
That won't work. What you propose would assign whatever is damaged to the body location. So for example if (the shades gets damaged) were recieved it would assign "the shades" to the body location when in fact it belongs in the eye location.
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: Thu Dec 22, 2005 12:41 pm   
 
nibbledeuce wrote:
the body variable contains the Breastplate of the Ravager


The initial problem was that the trigger would fire intermittently or not at all. My belief is that you defined the @body variable some of the time and when it was defined, the code would look it up and match the trigger.
As to it not doing exactly what you need, that was the exact example you provided above. I just corrected your errors. I understand it will try to remove the entire @body variable, but as stated above, that is what you asked for. Also, using the @bodydam variable in that manner will save the damage on all eq to one variable.


Last edited by Pseudo on Thu Dec 22, 2005 2:04 pm; edited 3 times in total
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: Thu Dec 22, 2005 1:14 pm   
 
As a followup, here is my interpretation of what you are really looking for. You will have to define the variables. These lists provide a way to lookup the shortname for the item that takes damage and verifies removal based on damage.

#var eqlist {the Breastplate of the Ravager|the shades}
#var eqaliaslist {breastplate|shades}
#var eqdamage {0|0}

#TRIGGER {^~(&body gets damaged~)$} {
#var itemcount %ismember(@body, @eqlist)
#IF (@itemcount>0) {
#IF (%item(@eqdamage,@itemcount)=14) {
#NOOP %replaceitem("0",@itemcount,@eqdamage)
remove %item(@eqaliaslist,@itemcount)
#ECHO @body %window has 1 ac remaining and has been REMOVED!!!
} {
#NOOP %replaceitem(%eval(%item(@eqdamage,@itemcount)+1),@itemcount,@eqdamage)
}
} {
#ECHO @body has no shortname in eqaliaslist!
}
}
Reply with quote
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Sat Dec 24, 2005 10:39 am   
 
Unfortunately again what you propose will not work.

Not all equipement has an ac appropriate for the value of 14 and each piece will vary.
Your not fixing errors, your rewriting and assuming too much.

Thanks anyway I have scrapped the script and accomplished the task from a different direction. I would have liked this script to work however it seems using an already assigned variable in the trigger pattern is not an effective or efficient way of doing things with the current version of zmud.
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: Sat Dec 24, 2005 1:40 pm   
 
The examples work, it's the question that's been lacking definition. *shrug*
I'm only posting this so people that want to use the script understand that it works.
If you need ac assignments for each item, add one more string list that holds the number for each item and look it up.
As for efficiency, the trigger only fires when the pattern is matched and there are no loops in the code. It uses a position-based lookup.
As for this thread, I think you are right. It is time to end it.
Reply with quote
nibbledeuce
Beginner


Joined: 06 Sep 2005
Posts: 11

PostPosted: Sun Dec 25, 2005 2:49 am   
 
Why are you being so defensive? I have not said your script was bad mearly that it would not work for what I need.

Don't put words in my mouth, I never said this should be closed simply that I have substituted a new script for the original. I even said I would have liked for it to work.
Don't get so defensive if what you proposed does not function as required by the person or the mud mentioned. You are too quick to say something works that you have not tested on the mentioned mud, which is soarly obvious.
The question was not lacking. I provided everything neccesary to troubleshoot the problem. You should take the chip off your shoulder and be less defensive.
The question was how to fix what I have, NOT how to do it your way which would basicaly scrap everything!

What I reffered to by "Efficient"
Lets say I change alignments and all my eq or a majority of it changes, now I have all new max ac amounts and all new keywords. Now with your proposed changes I'm stuck editing all over again, with my previous script it was automated. I'm sorry I didn't want to spam the board by posting the entire script and only posted the portion that does not work properly but I thought I was being polite.

Unfortunately I'm sure there is a very simple fix for the problem though nobody has posted it. Sad
_________________
Kill 1 man and your a murderer. Kill them all and your a GOD!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sun Dec 25, 2005 3:10 am   
 
From what i can tell your original code works.

I opened an empty settings file. (hit escape from the character selection window) Pasted in your code examples

#TR {^~(@body gets damaged~)$} {#AD BodyDam 1
#IF (@BodyDam=14) {
remove @body
#ECHO @body %window has 1 ac remaining and has been REMOVED!!!
} {}}

Made the body variable:

body=the Breastplate of the Ravager

Then i tested to see if it would fire on time:

#loop 14 {#ECHO (the Breastplate of the Ravager gets damaged)}

it fired on demand.. perhaps you have some other setting incrimenting @bodydam for you?
also.. i see nothing that sets @bodydam back to 0, you need that if its to ever fire more than once
_________________
Discord: Shalimarwildcat
Reply with quote
Dodgester
Wanderer


Joined: 17 Nov 2005
Posts: 65

PostPosted: Mon Dec 26, 2005 4:44 am   
 
Nibbie, not to be rude or anything, but from what I have seen in this thread, Pseudo and others has only tried to help you out on your issue. I don't know what your programming experience is or what type of environments you have worked with, but from what I see, I'm guessing either you have limited programming experience or you looking for something that is more or less like a true DB type system. Yes, zMUD is more advanced and sophisticated than other programs that I have seen out there for mudding purposes, but as far as having all of the bells and whistles, don't be expecting too much of that sort of stuff. Even today, I still use the program and it's the only program that I will use for mudding. That doesn't mean I would like to see some other features in it, like I would love to see more DB type stuff in it as it's good on the one hand, but on the other, it's not as easy to work with as your more sophisticated DB programs out there. I will say one thing while on the DB subject, the mapper is MDB based, which has allowed me to create other relevant tables and links as necessary, though I also have had to create my own set of forms too, but for the purposes of mudding, it's nothing extinuating as it's still relatively simple stuff as compared to the DB type work that I do at work.

Anyways, the one thing you need to learn from this, as with any programmer (regardless if you are a true programmer or a scriptor), there are going to be times when you run into either limitations (Such as those done by design) or bugs (Not done by design, but has not been resolved either), you have to become creative and find work arounds to those issues (which often times requires finding patterns and/or what's causing it, so as to know how to either address it or avoid it), and/or learn how to put to work with what you do have available to your disposition (Learn to make do with what you have to work with, like what I had to do when I had $4,000 per year in the mid 1990's to live on while going to college with the only real help for living expenses was a relative paying for my rent, but I still had to pay for all utilities except for water, and I also had to pay for everything else including laundry cleaning, and $10.00 budgetted for transportation per month, which didn't even allow for the local bus system at the discounted rate). Occassionally, you may even find an issue that wasn't working for you, but then at a later point of time when you attempt to use it how it was intended, it clears itself up. I just more or less ran into one such case, albeit though, that's very rare by nature to happen. However, if you have minimal amount of programming experience, I would suggest you first learn the 3 basic types of programming errors from easiest to hardest to resolve normally speaking, Syntax, Run-time, and Logical. Once you learn those 3 and realize how difficult it can be when it comes to those logical errors, you will then appreciate for what we have to go through from that point of view, and not only that, but often times, we also deal with programming codes of others, which may have very limited documentation, which makes it very tough to work with when it's something of that nature, or even the method/style of coding may be vastly different or not nearly as cleaned up as it could be.

Therefore, before you start blantently say it won't work, look at the examples that's been given to you and see if you can somehow use those examples to fit your needs. As I learned from an elementary teacher, who taught me how to learn for myself despite the learning disability that I had to deal with, look closely at the examples given and learn the process of it, which then when you are given problems of similar situations, apply what you learn from that process learning experience and work it through that way. For me, that was one of the greatest gifts given to me as most school officials treated me like I wasn't going to make it in life, but that one teacher who took his time and showed me the way, it really did open the door of learning for me. One of my problems was that I never really did learn that much in the classroom itself as I never was much of an audible person (even with me having very good hearing), but when it comes to learning via visual and tactically, I picked it up like nothing, and given the LD that I had, memorization was greatly enhanced for me, thus allowed me to read through materials one time and remember what it was getting at. I wouldn't remember the materials word for word, but still got the points down and if it involved processes, got those down too. I therefore ask you to do the same here, which many won't point this out as it's an unwritten rule cause of how obvious it should be (Maybe it was so obvious that you couldn't see it). Take a look at the examples, learn from them, and apply the process to your problem. There's plenty here that I can see already for you to do that with. You just have to work within the limitations that's also presented.

Granted, I don't post very much on here with issues that I have found, which based on my past experience, I didn't get responses as much, but then in those cases, not sure if it was due to the technicality of the issues, or due to how I tend to think of things as compared to others. You at least got responses and even should be able to adopt it to your issue after having to work with it a bit and figure how what it's doing. For me, I found that often times, it's just better for me to read through the help files and test things out, which there's been times I would have like to come onto here with it, but also due to what I had gotten as feedback, it wasn't as good. However, of recent, since I started to come back to the forum, it's been a much more pleasant experience than it was in the past, but I still do minimal posting with issues that I have. However, by going through those issues, I also learned a lot of how things works, but still have various questions too.

Sincerely,

Dodgester
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: Tue Jan 03, 2006 1:54 am   
 
honestly pseudo wasn't defensive, you didn't include enough details for the problems to be solved... In fact I find it quite rude to write something like this:

"Your not fixing errors, your rewriting and assuming too much."

In fact I find you assuming too much, by assuming the problem lies in the client rather than your pathetic scripting skills.

"however it seems using an already assigned variable in the trigger pattern is not an effective or efficient way of doing things with the current version of zmud."

And your suggestion that the client is "causing me to believe it's probably the clients interpreter failing to capture properly and not the script." is ridiculous. This is something what my grandma would say, "the calculator is not counting correctly, change it".
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: Tue Jan 03, 2006 4:33 pm   
 
I appreciate everyone's opinion on this matter, but it's just not worth flaming him. He's stated he just wants his script fixed, then when i post the answer to fix the specific problem, he continues to say that it wont work because of xxx that wasnt specified previously. I adjust the script appropriately, then yyy (which wasn't specified) appears. I make another workaround that requires assumptions because of the lack of definition of the problem and he is rude. It's been one brick wall after another with this thread. I've decided that I can't fix what I can't see.
So thanks anyways ppl.
ToyMage, I did find the comment about your grandma rather funny and appropriate. Calculators can be so confusing! If you've never learned how! :)
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