So I am very new to setting up triggers, timers, etc. I am sorry if I posted this in the wrong area but I was looking for someone to be able to tell me hoe to set something up to be able to make my character cast spells till he is out of mana then go to sleep in something and auto wake when his mana is full pick up the object he slept in and start casting spells all over again. I want to be able to have this done without me having to put any input in, want whatever it is i can set up to do all that for me... I know it seems cheap but I have more than one char and i have to spend most my time on another char.... Any help you can give is much appreciated.
Thanks
I mean...fundamentally, you need a bunch of triggers that trigger on some stuff and then do some stuff. You maybe need a bunch of variables that keep track of the stuff that you are doing and where you are in the sequences of doing those things. And you may also need some timers or some waits to appropriately delay engagement of the various actions. So, like, there are resources on the forum for how to write triggers and how to use variables and things. And none of us know how your game works other than you, so nobody can coordinate it for you without a lot more information.
You should try something yourself first and then ask more specific questions showing what you tried.
Well the game I play is legendsofkrynn.wolfpaw.net port 6100, you should try it, its an amazing mud with a great staff of Immortals. And to clarify then, I have a trigger that fires off of You dont have enough mana to go to sleep. I have another trigger that fires off You lost your concentration, that makes me cast one spell... What I want to be able to do is sleep and wake up when his mana if full. I also have a trigger that will fire off a successful spell cast to make me cast that same spell. Is this possible? There isnt a output from the mud I can fire off and using a timer doesnt always make me have full mana when I wake. I asked one of the Immortals and they told me to do a tick timer, and so hear I am. I am pretty much trying to spam a spell to get the skill up to a 100% without having to type anything.
ok, for starters, your prompt should make it fairly simple to know when mana is full.
You'll need a trigger for something like <*hp *m *mv> with a check against %2 for your maximum mana.
You'll probably need a timer (3-5 seconds) to get regular updates, maybe activated when your out of mana trigger puts the character to sleep.
*edit*
So, provided your prompt is set to something like <%h/%Hhp %m/%Mma %v/%Vmv> you should be able to use <*/*hp */*ma */*mv> as your trigger with an if check for %3 against %4 to see if mana is full and wake yourself up.
Yes, I actually created a character so I could see what your prompt options are.
It sounds to me like you need to wait x seconds (only you will know how long that is) and then have the timer send something to the MUD to find if your mana is full.
If it is full, and if you know you are asleep, then you could wake, otherwise wait a bit longer.
Ahh yes getting closer, I have done the trigger to fire off when my mana is full and autowake myself but it fires more than one because the prompt inout i get for my mana doesnt go down fast enough for the trigg to stop firing, so now my next question would be how can i make that trigg only fire once without having to re-create it everytime it fires
Ok, this is all concept so please don't try to just copy this and expect it to work. Once you've got some code working we can help you refine it and that link Nick gave you has some excellent help for you.
You don't have enough mana.
sleep -> enable mana timer
timer compares current and max mana
wake at match -> disable timer
It's worth noting that having played for a few levels now, that 3-5 second timer recommendation should probably be more like 30-45 seconds.
So what is it I need for coding and how do I get it.... This is why I am confused I do not know what I am doing here ^^^^^^COMPLETE NOOB^^^^^^^ and I know no one really likes newbies.
I was trying to establish flow of events for the triggers/timers to do what you asked about. As much to help myself lock it in my mind for further discussion as anything else honestly, since I've got poor Elderel basically stopped in any kind of progression now that he's out of newbie school. As nice as the customization is, I'm not really struck by LoK as anything resembling newbie friendly.
send to world doesn't recognize the enable (obviously), send to script throws "[string "Trigger: "]:2: '=' expected near 'EnableTimer' ", send to execute does the same thing as send to world.
Here's what I'm thinking for the trigger on the timer - I have it sending look every minute, could be anything really though just to refresh the prompt.
Those are triggers rather than scripts but the difference is largely academic for purposes of this discussion. Yes, I wrote them but they're still not quite right and I'm hoping one of the folks who does stuff like this more often than I comes along to point out my mistakes.
Think of triggers as scripting on the fly. They do the same things, scripts are simply in a preset file that can't be directly edited once it's loaded by MC and in use by the client. Triggers are small bits of editable script you can change as your needs on the MU* change.
Oh, Nick, when you get around to checking in here again, I'm using 4.94 now (was 4.84) and still getting that error where it expects = near EnableTimer
Ahh I see, well I know nothing about scripting... i dont understand how a script for a trigger to be fired would be written, nothing of the sort, if someone could kindly point this nood in a good starting space to learn that would be great, so i can start putting scripts in to my mud to do the things i want....since I started this post I have been doing all sorts of reading, including reading from Nicks scripting guide...
*Sighs Greatly*
Would love to know more...
Progress, at least a little bit - I found what was wrong with my sleep trigger. Turns out that mixing mud commands and script calls isn't quite as simple as I thought and I needed to use Send ("sleep") instead of just the command ... that's what happens when I stray out of my comfort zone, I have to learn new things lol.
Still tweaking the other half of the attempt at figuring out how to do this request, looking like it might not be workable off the prompt the way I tried to do it though. I'm thinking converting part of score to regex and working it that way might be a better option.
*edit* Yeah, def not firing on the prompt for this so back to the drawing board there.
Ok I know how to set up triggers from that fire from the output the mud send but i cant figure out how to make this into a trigger.
Finished version of the out of mana trigger:
Copy from <triggers> to </triggers>, open the triggers menu in MC, hit paste. What you're seeing here is the raw xml that MC saves triggers and whatnot as. For what it's worth, my current manacheck timer is a 90 second score sent directly to the mud though the attempt to match on the line that has mana on it isn't quite right yet.
Say i wanna add one of my own timers to the xml code that is there, I go to my time name it in the label area and the delete the manacheck in between the <> and put timer label there? I hope you understand what I am meaning....
So I was reading all sorts of things last night on scripting, this is scripting a trigger to add a timer, if someone could add more help on writing my own scripts this would become so much easier for me to understand... yes i know this is all in xml coding but it is still a script none the less...
Quote: if someone could add more help on writing my own scripts this would become so much easier for me to understand
If you asked more specific and detailed questions it would be much easier for us to offer suggestions. You have to help us help you by asking better questions.
Help me convert that line I posted earlier to a proper regex ;) I know the conversion I posted is wrong (solid foundation, bad numeric conversions) but I've always been horrible with regex conversions like that.
*edit*
It just occurred to me that converting that line to regex is only minimally necessary since it only needs to match on full mana and the stats won't change while sleeping. Provided there isn't a lot of gear changing going on, it should be possible to simply paste the line from score with full mana as the trigger to match to wake the sleeping caster and disable the associated timer. The only real benefit to the regex conversion at this point is not needing to change the trigger every time you gain a level or trade out a piece of gear that affects your mana pool.
To match multiple spaces where the exact count isn't critical, just do:
\s+
There were a number of things wrong with your regexp, and the code. This version works better:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="(?x) ^ \|{4} \s+ Int: \s+ \d+ \( \s* \d+ \) \s+ Wis: \s+ \d+ \( \s* \d+ \) \s+ : \s+ Mana: \s+ (\d+) \s+ / \s+ (\d+) \s+ \|{4} $"
regexp="y"
send_to="12"
sequence="100"
>
<send>
current = tonumber ("%1")
max = tonumber ("%2")
if current >= max then
EnableTimer("manacheck", false)
end
</send>
</trigger>
</triggers>
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
I used the "extended" regexp syntax (?x) to allow me to put spaces between each main item.
^ --> start of line
\|{4} --> 4 bars
\s* --> zero or more spaces
\s+ --> one or more spaces
\d+ --> one or more digits
\( --> literally a bracket
\) --> literally a closing bracket
(\d+) --> a "capture" group (capturing one or more digits)
$ --> end of line
You didn't have any capture groups. I have two so they become %1 and %2.
I've read that guide a number of times and I can do simple conversions but the more complicated it gets, the less accurate my conversions are :( I knew it had issues, that's why I brought it here to get help :)
Good news is I have confirmed that matching on score works for what SdwSkr was originally asking for help with and I'm just nostalgic enough for 3rd Age Krynn to give the place a look - not staying but they've done some interesting things with the place.
Thank you for the much sexier regex conversion and hopefully this gets SdwSkr well on the road to doing what he wants to do now and some enlightenment for his needs in the future. I know I learned a few things working on this little "thought exercise" trying to help him.
If you asked more specific and detailed questions it would be much easier for us to offer suggestions. You have to help us help you by asking better questions.
Ok I think I can word this so that someone can help me with what I want...
<triggers>
<trigger
enabled="y"
match="You lost your concentration."
regexp="y"
send_to="13"
sequence="100"
>
<send>c curse demian</send>
</trigger>
<trigger
enabled="y"
match="You narrow your eyes and glare"
regexp="y"
send_to="13"
sequence="100"
>
<send>c curse demian</send>
</trigger>
<trigger
enabled="y"
match="You wake and climb quickly to your feet."
regexp="y"
send_to="13"
sequence="100"
>
<send>c curse demian</send>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="You are feeling thirsty."
regexp="y"
send_to="13"
sequence="100"
>
<send>get bar can
drink bar
drink bar
drink bar
drink bar
drink bar
put bar can
</send>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="You are feeling hungry."
regexp="y"
send_to="13"
sequence="100"
>
<send>get rat can
eat rat
</send>
</trigger>
<trigger
enabled="y"
match="492/492m"
send_to="13"
sequence="100"
>
<send>prompt
wake</send>
</trigger>
<trigger
enabled="y"
match="You don't have enough mana."
send_to="13"
sequence="100"
>
<send>sleep camp
prompt</send>
</trigger>
</triggers>
There is 7 triggers here from my mushclient world, I clicked the copy button and got all this... What I want is for the You wake and climb quickly to your feet trigger to turn itself off after firing... I hope this makes it all easier for someone to help
<triggers>
<trigger
enabled="y"
match="You lost your concentration."
regexp="y"
send_to="13"
sequence="100"
>
<send>c curse demian</send>
</trigger>
<trigger
enabled="y"
match="You narrow your eyes and glare"
regexp="y"
send_to="13"
sequence="100"
>
<send>c curse demian</send>
</trigger>
<trigger
enabled="y"
match="You wake and climb quickly to your feet."
regexp="y"
send_to="13"
sequence="100"
>
<send>c curse demian</send>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="You are feeling thirsty."
regexp="y"
send_to="13"
sequence="100"
>
<send>get bar can
drink bar
drink bar
drink bar
drink bar
drink bar
put bar can
</send>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="You are feeling hungry."
regexp="y"
send_to="13"
sequence="100"
>
<send>get rat can
eat rat
</send>
</trigger>
Easier to read now, give me a minute to look at them this way and I'll see about helping you fix stuffs.
Ok, you'll need to make 2 changes to do this the way you want. You'll need to label the wake trigger. Add EnableTrigger ("wake") to the out of mana trigger so the wake trigger is active when you're sleeping and EnableTrigger ("wake", 0) to the end of the wake trigger so it turns itself off when you get back up.
What I want is for the You wake and climb quickly to your feet trigger to turn itself off after firing... I hope this makes it all easier for someone to help
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="You wake and climb quickly to your feet."
name="You_Wake"
send_to="12"
sequence="100"
>
<send>
Send ("c curse demian")
EnableTrigger ("You_Wake", false) -- disable myself
</send>
</trigger>
</triggers>
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
That gives the trigger a name (label) which is "You_Wake". Once it fires it disables itself. You will of course have to enable it elsewhere later.