Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Sipper Help

Sipper Help

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Archibald   (12 posts)  Bio
Date Wed 30 Apr 2008 09:51 AM (UTC)

Amended on Wed 30 Apr 2008 10:28 AM (UTC) by Archibald

Message
Hey everyone! I know there have already been a bunch of threads like this, e.g people asking something to the effect of "u know how u can get my sipper wrokring better?" Well anyways, I noticed those threads didn't get alot of replies. Please help!

I know a little bit about VB script but to be honest when I make triggers, aliases, variables, or whatever I'm doing for the mud I play, I'm basically just wingin' it. I'm not completely retarded though! I want to know more, so could someone point me out to a good beginners guide or book to vb script? O.o

Anyways I digress. Why am I posting? I'm trying to make a sipper from scratch! I've started off by making triggers of my prompt and score card that store the values of my current health/mana/ego/whatever and my max current h/m/e/etc.

Ok so I have these values, I have a .vbs file, I know how to edit it, etc. I just dont know where to go from here.

In the mud I play (the dreaded Lusternia) you can sip either a health, mana, or ego vial every 4ish seconds. When you can, you will get this message:

You may drink another health, mana, or bromide potion.

Well isn't that fine and dandy? I know you're thinking... WILL YOU GET TO THE FRAKING POINT ALREADY ARCHIBALD?!?

1. I want to be able to set a percent value to when I sip. Like at 75% for instance.
2. I want to be able to prioritize sipping orders. This sounds complicated! Like, if I take 100 mana damage, but also take 2000 health damage, I dont want to be sipping for mana if you know what I mean. Anyone know how I might accomplish this?
3. I want to be only able to sip once per "You may drink another health, mana, or bromide potion." Because right now in my earlier attempts at making a sipper I'm looping, MUSHclient is crashing, I'm sipping for three values at once, its a nightmare (lol)

This is what I got right now, yes, feel free to point and laugh at meh. :'(

Sub sipper (a, b, c)
If getvariable("P_health") < getvariable("Max_health") Then
send "drink health"
end if
If getvariable("P_mana") < getvariable("Max_mana") Then
send "drink mana"
end if
If getvariable("P_ego") < getvariable("Max_ego") Then
send "drink bromides"
end if
end sub

(P_ = prompt, and I'm calling this in my prompt trigger)

Please help me, O' coding and Mush Gods. (I'm looking at you Nick, Shaun, Shadowfyr :D) *prostrates*

Ideas, input, advice, anything!


Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 30 Apr 2008 09:21 PM (UTC)
Message
I don't suppose you want to switch to Lua? Oh well.

Before we get too far into analyzing why this doesn't work perfectly, can you please copy and paste the whole trigger?

See: http://mushclient.com/copying

And that is the actual script, copied and pasted? I don't see how this will work:


Sub sipper (a, b, c)
  If getvariable("P_health") < getvariable("Max_health") Then
  send "drink health"
  end if

...


In a prompt script you need to check the prompt details - that is in the wildcards, which is argument "c" in your script.

Also can you please post an example prompt? And the actual line which says something like "You may drink another health, mana, or bromide potion."?

Quote:

I want to be able to set a percent value to when I sip. Like at 75% for instance.


How will you know when you are at 75%? You need to know the 100% value to do that. Is that in the prompt, or somewhere else?

Quote:

I'm sipping for three values at once, its a nightmare


Well it would, as that is what you told it to do. At the very least, you would make it:


If getvariable("P_health") < getvariable("Max_health") Then
  send "drink health"
  Exit Sub
end if


In other words, once you sip, you stop doing anything else.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Archibald   (12 posts)  Bio
Date Reply #2 on Wed 30 Apr 2008 11:42 PM (UTC)

Amended on Wed 30 Apr 2008 11:44 PM (UTC) by Archibald

Message
Thank you so much for replying nick! Is Lua hard to learn? I might give it a try if you really suggest it. I doubt it would be a huge leap for me considering my already somewhat weak experience with this stuff.

What I posted is apart of a script file I want to call each time my prompt trigger fires, uh, here that is...


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="^(.*?)h\, (.*?)m\, (.*?)e\, (.*?)p"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.SetVariable "P_health", "%1"
world.SetVariable "P_mana", "%2"
world.SetVariable "P_ego", "%3"
call sipper (a, b, c)</send>
  </trigger>
</triggers>

And I have my max values stored with:
(I check them immediately when I log in, so they are stored before my first prompt fires O_o)

<triggers>
  <trigger
   custom_colour="16"
   enabled="y"
   expand_variables="y"
   match="Ego    : (.*?)/(.*?) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.SetVariable "Current_ego", "%1"
world.SetVariable "Max_ego", "%2"
</send>
  </trigger>
  <trigger
   custom_colour="16"
   enabled="y"
   expand_variables="y"
   match="Health : (.*?)/(.*?) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.SetVariable "Current_health", "%1"
world.SetVariable "Max_health", "%2"
</send>
  </trigger>
  <trigger
   custom_colour="16"
   enabled="y"
   expand_variables="y"
   match="Mana   : (.*?)/(.*?) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.SetVariable "Current_mana", "%1"
world.SetVariable "Max_mana", "%2"
</send>
  </trigger>
</triggers>


Quote:
Also can you please post an example prompt?And the actual line which says something like "You may drink another health, mana, or bromide potion."?


Here is that "example prompt" you asked for:


417h, 444m, 441e, 10p ex-


And the actual line is:

You may drink another health, mana, or bromide potion.


I think that was what you were asking, right? O.o Anyways, a question. In:


If getvariable("P_health") < getvariable("Max_health") Then
  send "drink health"
  Exit Sub
end if


Is it possible to add a percentage to the arguement? Er like = or < 75% of "Max_health"?




Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,992 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.