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
Halse
Newbie


Joined: 07 Apr 2008
Posts: 1

PostPosted: Mon Apr 07, 2008 7:30 am   

Autosipper Script for Lusternia
 
Greetings,

I'm new to coding period and was hoping someone might be able to help me out here?

I am trying to take and make an autosipper script for the Mud Lusternia. But I am unsure of how to go about this...I know I need to trigger the prompt...and have a variable...but aside from that I am lost...

My prompt looks like this.
Quote:

3795h, 3900m, 3900e, 0p


I guess I will name the variable health...

Thank you in advance
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Apr 07, 2008 11:42 am   
 
At the simplest level, you're going to need to know what your health is. So you need a variable for that that's set by your prompt:

#trig {^(%d)h, (%d)m, (%d)e, (%d)p} {health=%1} "" {nocr|prompt}

Now, you need to know if you can sip or not:

#var CanSip 1
#trig {You can drink another elixir} {CanSip=1}

This pattern is wrong, I know, because I played Lusternia for a bit. You'll have to put the right one in.

Finally, you need to know what your max health is. I can't remember what the score looks like, but it should be pretty easy to write a trigger for that, given what I showed you in the prompt trigger above. I'll assume that it's named @MaxHealth. Now you add an #if to your prompt so that it looks like this:

#trig {^(%d)h, (%d)m, (%d)e, (%d)p} {health=%1;#if (@CanSip AND @health<%eval(@MaxHealth*4/5)) {drink health;CanSip=0}} "" {nocr|prompt}

This will drink if your health is less than 4/5 of its maximum. You can change that number if you like.

This script isn't very robust - anything that stops you sipping will cause the script to fail. The drink health command will be sent and CanSip will be set to 0, but because you never sipped, you'll never be told you can sip again and it'll never be set to 1 again. There're many ways to get around this, the simplest of which would be to make an alias or macro for sipping and do it manually in the event that it stops working. A more complex solution would be to add an alarm to reset the variable or to add another trigger that retries if it doesn't see a "You drink some health" line.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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