|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 5:12 am
Newbie question |
Hi, I'm new to CMUD, and I need some help. I'm using v1.34 and I'm having trouble creating triggers. I get into the "Package Editor" menu and click "New", and there are input fields for "Pattern" and "Script Text". Now I'm just trying to make the basic trigger shown in the tutorials:
Code: |
#TRIG {chats} {#COLOR red} |
And I don't really know where to put this. Like I said I see two input fields, Pattern/Script Text, and don't know where to type my trigger. I've tried both, saved, and the trigger doesn't seem to work. It also doesn't help that there are several scripting languages to choose from. I'm assuming it's zScript, although I've tried all the options and nothing works.
I realize this is a pretty dumb question but as I can't find an answer in the documentation I thought I'd post here.
Thanks. |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Wed Jul 04, 2007 5:18 am |
#TRIG {Pattern} {commands}
So put "chats" in the pattern, and "#COLOR red" in the "Commands" field. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 5:21 am |
And that's zScript, right?
|
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 5:27 am |
Hey thanks, it worked! I've also got another question, how do I make triggers execute in a particular order, and loop indefinitely? I also need to know how to make the triggers execute only when one particular stat value is full.
|
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 6:02 am |
I'm trying to do something like this, in the mud I'm playing, stuff that isn't commands is in { } brackets, important replies from MUD are in [ ] :
{wait until "Gp" value is full}
trace rune with staff
trace rune with staff
trace rune with staff
trace rune with staff
{wait until "Gp" value is full}
cast sfp
{this would repeat until I get the message below}
[You are exhausted. Wait a while before casting this spell again.]
{wait until "Gp" is full}
trace rune with staff
trace rune with staff
trace rune with staff
trace rune with staff
{wait until "Gp" is full}
cast mpol
{this would repeat until I get the message below}
[You are exhausted. Wait a while before casting this spell again.]
{wait until "Gp" is full}
trace rune with staff
trace rune with staff
trace rune with staff
trace rune with staff
{wait until "Gp" is full}
cast eff
{this would repeat until I get the message below}
[You are exhausted. Wait a while before casting this spell again.]
And I'd want this to loop. I realize it's probably not very complicated but I wouldn't know how to script it, and how to put it all in one trigger. I think I might be able to figure it out except I don't know how to make the script wait until that one value is full before proceeding. any help? |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Wed Jul 04, 2007 7:01 am |
I am not entirely sure what you are trying to do there. Please explain a bit more. Perhaps copy/paste some direct mud output, or explain what the spells do, what restrictions are opn them what 'Gp' is, how will you know when it is full, etc. At the moment I've about as much chance of helping you as if you'd posted "help" and nothing else :p
And yes, my suggestions will always be in zscript. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 7:49 am |
Those are just alias nicknames for the spells. What they actually do is kind of complicated but it's not that important, this is a sequence used to advance magic skills that I want to be able to automate. It would alternate between the rune commands and casting the SAME spell until I get the "you are exhausted" message meaning there is no further skill benfit to casting the spell and that I should move on to the next one. Always alternates between current spell/runes. Gp, guild points, which for all intents and purposes = mana, needs to be refilled in between magic commands (automatically recharges over time), but I don't know the script command for this, say, wait until value 'x' is full before casting. I just need to automate and loop all this in a trigger as typing it is very repetitive. Thanks in advance.
|
|
Last edited by D0nut on Wed Jul 04, 2007 7:52 am; edited 1 time in total |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Wed Jul 04, 2007 8:29 am |
There is still not enough information there, so I am guessing what you want to do. My guess is that "trace run with staff" refills your "Gp" level, and casting the spells over and over reduces it.
If that is so, then perhaps something like:
Code: |
#VAR spelllist {spell1|}spell2|spell3}
#ALIAS practicespells {gp=0
#UNTIL (gp=1) {#EXEC %item(@spelllist, 1)}
}
#TR {You are exhausted. Wait a while before casting this spell again.} {gp=1
#DELITEM spelllist {%item(@spelllist, 1}
}
|
That loop cannot self-perpetuate, but its not clear how a script is supposed to tell when Gp is full/empty so... thats a general-direction bit of advice. Until you can suppy better information, I can't help you completely. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jul 04, 2007 12:25 pm |
EDIT: This post was a bit of a wall of text, so I separated it into halves. If you don't understand anything, just ask.
In response to your old question about the #trig command - the #trig command actually creates triggers for you. You just paste it onto the command line and hit enter and it should make it for you.
About looping triggers - this concept is a multistate trigger. In script form, it looks like this:
#trig {pattern1} {commands}
#cond {pattern2} {commands}
The #cond command creates a new trigger state. You can also create states using the editor GUI the same way you make everything else - just select the trigger you want to add states to and choose Trigger State from the New menu.
There are many different kinds of trigger state, but the rule is simple - only one state is active at a time, and the trigger will only move onto the next state once the last one has fired. The previous trigger will only be looking for pattern1 - once it gets pattern1, it'll switch to looking for pattern2 and ignore pattern1. Once pattern2 has fired, it'll loop round and go back to looking for pattern1.
------------------------------------------
Your third problem's a bit more complicated. I'd probably do this with a multistate trigger and an alarm to prevent spamming. I assume that your Gp value is on your prompt - you'll need to set up your own prompt trigger to capture a value for Gp. We can help with that if you give us some prompts.
At the moment it's unclear exactly what you want the script to do. There are two possibilities:
Wait for Gp. Trace rune 4 times (or do you want it to trace rune until you run out of Gp?). Repeat spell over and over, waiting for Gp when need be, until you get the "you are exhausted" message, and then begin the whole loop again. This would need to be stoppable at any time without having to disable all triggers/parsing.
I'm going to assume you only want trace rune to be sent 4 times.
#var Gp 0
#var MaxGP 1
#alias LearnSpell {#additem SpellsList %1}
#alias StartLearning {#if (@SpellsList) {#t+ Practice} {#say Add some spells to the list to learn first using LEARNSPELL ~<spell~>.}}
#alias StopLearning {#t- Practice;#state Practice 0;#untrig PracAlarm}
#trig "Practice" {@Gp=@MaxGP} {#4 {trace rune with staff}} "" {disable|exp}
#cond {@Gp=@MaxGP} {$spell=%item(@SpellsList,1);#alarm "PracAlarm" *0.501 {cast $spell}} {exp}
#cond {You are exhausted. Wait a while before casting this spell again.} {#delnitem SpellsList 1;stoplearning;startlearning}
#t- Practice
Note: The two lines about the Gp variables at the top are to stop the script firing before you want it to. The #t- at the end disables the trigger so that it'll only be active when you StartLearning.
Note2: Because of the multistate trigger GUI bug(s) I posted here, I haven't actually been able to debug this script properly and it's not working. Once the GUI is fixed or I find a workaround, I'll be able to debug it and repost the working script. For now, I'll leave it here as an example of the concept. |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 2:57 pm |
Ok thanks. Well I automatically have 3 bars on my prompt, Hp, Gp, Xp, if that's what you mean. Gp is currently 256/256, but that max value increases as skills increase.
Thing is I'm not sure that's exactly what I need. Trace runes command is repeated, preferably not 4x, but until it says "You should take a break". So roughly the sequence would be something like:
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast Sfp ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast Sfp ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast Sfp ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast eff ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast eff ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast eff ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast mpol ONCE
-gp refill
-keep sending trace runes with staff command until "You should take a break" condition
-gp refill
-cast mpol ONCE
<end of sequence, restart>
It would end up looking something like this, except i'm justy guessing on the 3 casts per spell. It would be repeated until the "you are exhausted" condition. With my skill level I don't understand your script, so I'm hoping this is what you meant. Does that make more sense? |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 3:03 pm |
Actually Gp isn't on the prompt, rather, those 3 values are in the CMUD GUI and automatically update. They're accessed through the score brief command in-game.
|
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Wed Jul 04, 2007 4:09 pm |
Please, please please, copy/paste a big chunk of the actual mud output while you do this manually.. you may not understand why this is so confusing, but it is and I don't think anything else will make it clear.
|
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Wed Jul 04, 2007 4:18 pm |
The output will probably be even more confusing for you, I'm just trying to simplify it here. I think the last big post pretty much sums up what I'm trying to do with previously mentioned commands, and I believe Fang almost has the right script, except the "trace runes with staff" command keeps repeating.
|
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Thu Jul 05, 2007 1:00 am |
D0nut wrote: |
The output will probably be even more confusing for you, I'm just trying to simplify it here. I think the last big post pretty much sums up what I'm trying to do with previously mentioned commands, and I believe Fang almost has the right script, except the "trace runes with staff" command keeps repeating. |
If you say so. Answer me this anyway:
In your long post, what does "-Gp refill" refer to? Mud output? Prompt? That it is "refilling"? I don't get what that bit means. Is it just a comment from you? Why does "Gp refill" appear after both staff commands and the spells you cast? Is that line even relevent?
Am I understanding it correctly when I say that the staff command increases your current Gp value, casting spells decreases the current Gp but increases the max?
I'd do it somewhat similar to Fang's suggestion, yet I'd consider using reparse trigs since we can't access the Gp value directly and must operate on messages only. I'll attempt to use as much of Fang's as possible.
The following requires a line you have not supplied (mud output confirming when a trace rune spell has been cast successfully). This can still be done without that message, but a little messily. It would also be neater if reparse triggers still worked on manual trigger types, but that was changed a long time ago, so far as I can tell (back in zmud. It did work once though :( ). Thankfully, putting * on a reparse at the end, forces state number 1 to act as thought it is manual anyway. Hooray for hack workarounds >.>
#alias LearnSpell {#additem SpellsList %1}
#alias StartLearning {#if (@SpellsList) {#state Practice 1;trace rune with staff} {#say Add some spells to the list to learn first using LEARNSPELL ~<spell~>.}}
#alias StopLearning {#STATE Practice 0;#SAY Spell List empty. Ending practice.}
#TR "Practice" {This is the skill auto-practice trigger.} {} {manual}
#COND {*} {}
#COND {You should take a break.} {#state practice 1;cast %item(@SpellsList,1);trace rune with staff} {reparse}
#COND {You are exhausted. Wait a while before casting this spell again.} {#state practice 1;#delnitem SpellsList 1;#IF (!%numitems(@SpellsList)) {stoplearning} {trace rune with staff}} {reparse}
#COND {Pattern indicating successful trace rune with staff command.} {#state practice 1;trace rune with staff} {reparse}
#COND {*} {#state practice 1} {reparse}
Syntax Colourizer
I tested this out with #show as best as I could. It turns itself off correctly, changes spells correctly, the only thing which may be a problem, and I cannot know this for sure because I don't have enough information from you, is this:
Quote: |
Pattern indicating successful trace runes with staff command.
trace rune with staff
Pattern indicating successful trace runes with staff command.
trace rune with staff
You should take a break
cast spell1
trace rune with staff
You are exhausted. Wait a while before casting this spell again.
trace rune with staff |
Green text being commands sent by this script. The rest being my simulated text received from the mud, using #SHOW. The potential problem bit being the 'You are exhausted' line. That may or may not need fiddling with. Depending.
P.S. Fang, how did you get the neat colouring in the script you posted? Did you do it all by hand or is there some other way or making it pretty? Edit: I just saw your sig. Nice! |
|
_________________ Athlon 64 3200+
Win XP Pro x64
Last edited by Caled on Thu Jul 05, 2007 3:44 am; edited 1 time in total |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 05, 2007 1:22 am |
Make sure you turn the pretty print mode off (it doesn't work well since the forums eat spaces) and only use CMUD mode for CMUD scripts.
One question - what's stopping you removing that "fake" first state and just using #state 1 to reset the trigger to first real state? |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Thu Jul 05, 2007 3:36 am |
The only reason for the fake first state, is because if I had * as the first state, I'd have to use #T-/#T+ to toggle the trig on off. Not that there is anything wrong with doing that, I just got into the bahit of doing it this way in zmud, purely for the fact that in zmud the trigger was named with the pattern in the first state, which (if it was *) made it difficult to ever find the trigger again if lost.
In CMUD its different.. they get "named" based on the trig ID, and #T-/+ is also more predictable (never creating classes) so it'd be much mnore acceptable to me to use that. However, habits are habits and that has just become my way of scripting. I use reparse quite a bit.. at first only because I was curious about how powerful multistate trigs were, and then because I got comfortable using them, and like the way a script spanning multiple trigs/aliases can be combined into one single trigger.
The ideal way of doing it is to use #ONINPUT as #STATE 0, and using that to replace the "StartLearning" alias. Not something I did in zmud due to that previously mentioned naming problem, but I think I will in CMUD. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Thu Jul 05, 2007 4:10 am |
Ok, I need to re-explain this. Gp is one of the most important values. It's depleted by using both commands. I want the script to wait after executing either trace runes with staff or cast [spell] until the Gp value has regenerated to the maximum, and then cast the next one. You need the Gp to be full in between commands for the full effect. Does that make more sense?
|
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Thu Jul 05, 2007 4:12 am |
Yes it does. How can the script know if it is full? What message is sent by the mud?
|
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Thu Jul 05, 2007 4:21 am |
I'm not sure. But it shows up in my CMUD GUI at the bottom of the screen alongside Hp and Xp, so I assume it could be added into a prompt? Just so you know by default I don't have a prompt in this MUD and can't see Hp/Gp/Xp without typing a stats command.
|
|
Last edited by D0nut on Thu Jul 05, 2007 4:27 am; edited 1 time in total |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Thu Jul 05, 2007 4:25 am |
I suppose it might be easier to do with a time delay, although making the script figure out when Gp is at max value would be more efficient.
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Jul 05, 2007 4:55 am |
The mud is prolly using MXP to create the GUI gauges, Like everyone said post a log of actual mud output manually doing exactly what you a script to do. We all play muds here, I am pretty sure we can figure out what you want done when we have actual examples. All the "Guru's" on this forum volunteer their time answering questions and the more cloak + dagger the question the more they are likely to ignore it.
|
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Thu Jul 05, 2007 5:08 am |
If mxp is being used, then there should be a variable somewhere in your system that contains the value for Gp. Search for that, find it, and we can use it.
And Nexela is right. If you'd just posted some actual output form the beginning, someone could have helped properly a lot sooner. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Thu Jul 05, 2007 5:19 am |
Well how do I find this value?
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Jul 05, 2007 5:42 am |
If it's MXP or Pueblo, there should be a regular zscript variable somewhere in your settings you don't remember creating or can't figure out what it's for.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
D0nut Beginner
Joined: 04 Jul 2007 Posts: 23
|
Posted: Thu Jul 05, 2007 5:54 am |
Yeah, I think I found it. It's in MUD > System > MXP.
Status Bar: Gp
-----------------
Name: Gp
Value: gp %mud.gp
Is it possible to do the script now with this value? |
|
|
|
|
|