Can't get the auto sipper to work :(

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Can't get the auto sipper to work :(

Post by Skriptz »

I'm trying to make my first script and have no idea what it's doing wrong.

This is in a trigger with the perl regex chosen.

Code: Select all

^H:(\d+) M:(\d+) XP:(\d+)%
This is what my prompt looks like.

Code: Select all

H:1600 M:1755 XP:66% [eb]
This is the script I have done, but it won't auto sip.

Code: Select all

CurrentHealth = matches[1]
CurrentMana = matches[2]

if CurrentHealth >= 1300 then 
	send("sip health")
end
I also added this to the script section hoping that it may need a global variable but still nothing and it doesn't change.
CurrentMana = nil
CurrentHealth = nil

User avatar
Alexander Divine
Posts: 65
Joined: Mon Dec 21, 2009 7:01 pm

Re: Can't get the auto sipper to work :(

Post by Alexander Divine »

You have two issues.

Firstly, change your CurrentHealth and CurrentMana to matches[2] and matches[3], respectively. Matches[1] will match entire trigger that was matched, so you're actually setting your CurrentHealth to your prompt as a string.

Secondly, make sure that you're sipping when CurrentHealth <= 1300, not >=. Otherwise, you're only gonna sip when you're above that threshold!

Additionally, setting CurrentHealth and CurrentMana to nil is just the same as not setting them at all. Basically you're erasing the variables. Think of it this way: every variable starts as nil. I recommend CurrentHealth = 0, but in the case of an autosipper it's not necessary.

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: Can't get the auto sipper to work :(

Post by Skriptz »

Thanks for the quick response but it still isn't working. I tried deleting the script part as I thought it might interfere somehow and added match[4] for my experience but still not working :(

User avatar
Alexander Divine
Posts: 65
Joined: Mon Dec 21, 2009 7:01 pm

Re: Can't get the auto sipper to work :(

Post by Alexander Divine »

Try this.

Trigger Pattern

Code: Select all

^H:(\d+) M:(\d+) XP:(\d+)\% \[(.*)\]$
Scriptiness

Code: Select all

CurrentHealth = matches[2]
CurrentMana = matches[3]
If that doesn't do it, I don't know what will!

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Can't get the auto sipper to work :(

Post by Vadi »

HP = tonumber(matches[2])

User avatar
Alexander Divine
Posts: 65
Joined: Mon Dec 21, 2009 7:01 pm

Re: Can't get the auto sipper to work :(

Post by Alexander Divine »

OH RIIIIIIIIGHT

I thought I was forgetting something!

From what I understand, by default, everything you declare as a variable will have a string as its value. So there's that up there.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Can't get the auto sipper to work :(

Post by Vadi »

No, its just that our matches table is all in strings.

If you do var = 5 then its a number fine.

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: Can't get the auto sipper to work :(

Post by Skriptz »

Excellent, okay the first part is working. Thanks guys.

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: Can't get the auto sipper to work :(

Post by Skriptz »

Edit: I worked it out. I need to be VERY specific in what TYPE of trigger to use.

Okay I got it working but when the first sip doesn't heal it above what I would like it at, it will keep on sipping when I don't have balance on it yet meaning I'm wasting a lot of health. So What I tried to do is, is to add a variable. GotElixerBalance with triggers to make it 0 which means I don't have balance and 1 which I have. However it's only seeing the 1.

Triggers are:

Code: Select all

^You take a drink of an elixir of health from a
^The elixir flows down your throat without effect.$
Which results in

Code: Select all

GotElixerBal = 0
Next Trigger to make it true is

Code: Select all

^You may drink another health or mana elixir.$
Which makes it do

Code: Select all

GotElixerBal = 1
My new Sipping on prompt trigger code is

Code: Select all

CurrentHealth = tonumber(matches[2])
CurrentMana = tonumber(matches[3])
Exp = matches[4]
SipHealth = (MaxHealth * 0.75)

if (CurrentHealth < SipHealth)
	and GotElixerBal==1 then 
		send("sip health")
end

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Can't get the auto sipper to work :(

Post by Vadi »

You may drink another health or man elixir.

As exact match is the fastest trigger type to use btw

Post Reply