Vadi Sipper for Achaea

Share your scripts and packages with other Mudlet users.
Wennef
Posts: 43
Joined: Sun Apr 11, 2010 3:48 am

Re: Vadi Sipper for Achaea

Post by Wennef »

Thanks! These scripts are excellent learning tools.

naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Re: Vadi Sipper for Achaea

Post by naftali »

Vadi wrote:Hm... actually before you're even connected and right after mudlet starts :P
Hehe yup, that's why I changed it into a script that could me made to run on a login trigger. Come to think if it, I could make it part of the 'CharName' event handler, since that only runs at login.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Vadi Sipper for Achaea

Post by Heiko »

That's generally a good idea as ATCP related events cannot be faked by other players.

Wennef
Posts: 43
Joined: Sun Apr 11, 2010 3:48 am

Re: Vadi Sipper for Achaea

Post by Wennef »

I've put it in, and it sips. Problem is, I can't see the changes with tracking on. Is there something wrong with how I pasted?

Code: Select all

function CharVitals(event, arg)
	local r = rex.new( "H:(\\d+)/(\\d+) M:(\\d+)/(\\d+) E:(\\d+)/(\\d+) W:(\\d+)/(\\d+) NL:(\\d+)/(\\d+) " )
	if r:match( arg ) then
		if sipper.tracking == 1 then
		sipper.prev_health = status.current_health
		sipper.prev_mana = status.current_mana
		end

		status.current_health, status.max_health, 
		status.current_mana, status.max_mana, 
		status.current_endurance, status.max_endurance, 
		status.current_willpower, status.max_willpower, 
		status.next_level = r:match( arg )
	end

		status.current_health = tonumber( status.current_health )
		status.max_health = tonumber( status.max_health )
		status.current_mana = tonumber( status.current_mana )
		status.max_mana = tonumber( status.max_mana )
		status.current_endurance = tonumber( status.current_endurance )
		status.max_endurance = tonumber( status.max_endurance )
		status.current_willpower = tonumber( status.current_willpower )
		status.max_willpower = tonumber( status.max_willpower )
		status.next_level = tonumber( status.next_level )

if sipper.tracking == 1 then
	sipper.healthdifference = status.current_health - sipper.prev_health
  	sipper.manadifference = status.current_mana - sipper.prev_mana
	tempLineTrigger(1,1,[[echoChange()]])
end

--	Change these to set where you start sipping - right now you start sipping at 300 under
--	your max health or mana and start eating moss at 800 under your max health or mana

	sipper.siphealth = status.max_health*0.6
	sipper.sipmana = status.max_mana*0.5
	sipper.mosshealth = status.max_health*0.25
	sipper.mossmana = status.max_mana*0.25

	if sipper.paused == 0 then
		if sipper.healbalance == 1 and sipper.priority == 1 then
			if status.current_health <= sipper.siphealth then
				send("sip health")
				sipper.healbalance = 0.5
			elseif status.current_mana <= sipper.sipmana then
				send("sip mana")
				sipper.healbalance = 0.5
			end
		elseif sipper.healbalance == 1 then
			if status.current_mana <= sipper.sipmana then
				send ("sip mana")
				sipper.healbalance = 0.5
			elseif status.current_health <= sipper.siphealth then
				send ("sip health")
				sipper.healbalance = 0.5
			end
		end
		if sipper.mossbalance == 1 and ( status.current_health <= sipper.mosshealth or status.current_mana <= sipper.mossmana ) then
			sendAll("outr moss","eat moss")
			sipper.mossbalance = 0.5
		end
	end
end

function echoChange()
        moveCursorEnd("main")
        if sipper.healthdifference == 0 and sipper.manadifference == 0 then return end
        insertText("(")
        if sipper.healthdifference > 0 then
                moveCursorEnd("main")
                fg("green")
                insertText(string.format("+%d Health", sipper.healthdifference))
                resetFormat()
        elseif sipper.healthdifference < 0 then
                moveCursorEnd("main")
                fg("red")
                insertText(string.format("%d Health", sipper.healthdifference))
                resetFormat()
        end
        if sipper.healthdifference ~= 0 and sipper.manadifference ~= 0 then
                moveCursorEnd("main")
                insertText(", ")
        end
        if sipper.manadifference > 0 then
                moveCursorEnd("main")
                fg("green")
                insertText(string.format("+%d Mana", sipper.manadifference))
                resetFormat()
        elseif sipper.manadifference < 0 then
                moveCursorEnd("main")
                fg("red")
                insertText(string.format("%d Mana", sipper.manadifference))
                resetFormat()
        end
        moveCursorEnd("main")
        insertText(")")
end

naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Re: Vadi Sipper for Achaea

Post by naftali »

I've been having trouble too, actually. I think the tracking function is somehow broken now, I'll need to take another look at it.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Vadi Sipper for Achaea

Post by Manni »

Does Vadi's Sipper work with gmcp on?

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

Re: Vadi Sipper for Achaea

Post by Vadi »

Not without modification to have it work with gmcp instead of atcp.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Vadi Sipper for Achaea

Post by Manni »

Is that a simple modification? I'd like to have it work while I'm mapping some new areas

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Vadi Sipper for Achaea

Post by Manni »

Do either of these sippers work with mudbot?

User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Vadi Sipper for Achaea

Post by keneanung »

That depends on the mudbot you use. Some were adapted to let gmcp or atcp pass through.

Post Reply