ATCP demo scripts

Share your scripts and packages with other Mudlet users.
User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: ATCP demo scripts

Post by demonnic »

that'll be the output of a display() function, I believe. For a table which is empty.

Ilithyia
Posts: 43
Joined: Wed Mar 10, 2010 11:04 pm

Re: ATCP demo scripts

Post by Ilithyia »

Ah, I see now.

Now, I'm wondering why my tables are empty, instead of parsing nicely like is shown in Vadi's sample output?

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

Re: ATCP demo scripts

Post by Vadi »

CharVitals string would need to be changed for your MUD if it's not Achaea, because each IRE MUD uses a different formnat for the text. The rest, not sure - you'd need to check by doing display(whatever) at the different stages of the script to see where things are going wrong in your MUD.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: ATCP demo scripts

Post by demonnic »

you may want to try a simple call to

display(atcp)

also, if you're using mudbot/lmts/a proxy of almost any time then ATCP may not be getting passed to mudlet.

Ilithyia
Posts: 43
Joined: Wed Mar 10, 2010 11:04 pm

Re: ATCP demo scripts

Post by Ilithyia »

Alright, I figured out the ATCP parsing. (Thanks for the script, Vadi!) I'm trying to incorporate Vadi's autosipper with ATCP, especially for cases of recklessness, blackout, or when locked into an aethership module. This is what I have so far:

Code: Select all

status = {}

function CharVitals(event, arg)
		local r = rex.new( "NL:(\\d+)/100 H:(\\d+)/(\\d+) M:(\\d+)/(\\d+) E:(\\d+)/(\\d+) P:(\\d+)/(\\d+) N:(\\d+)/(\\d+) W:(\\d+)/(\\d+)" )
		if r:match( arg ) then
			status.next_level,
			status.current_health, status.max_health, 
			status.current_mana, status.max_mana, 
			status.current_ego, status.max_ego, 
			status.current_power, status.max_power, 
			status.current_endurance, status.max_endurance, 
			status.current_willpower, status.max_willpower = r:match( arg )
		end

siphealth = status.max_health*0.75
sipmana = status.max_mana*0.75
sipego = status.max_ego*0.75
berryhealth = status.max_health*0.50
berrymana = status.max_mana*0.50

currenthealth = status.current_health
currentmana = status.current_mana
currentego = status.current_ego

display(status)

echo("\nsiphealth = " .. siphealth)
echo("\nsipmana = " .. sipmana)
echo("\nsipego = " .. sipego)
echo("\nberryhealth = " .. berryhealth)
echo("\nberrymana = " .. berrymana)

echo("\ncurrenthealth = " .. currenthealth)
echo("\ncurrentmana = " .. currentmana)
echo("\ncurrentego = " .. currentego)
echo("\n\nhealbalance = " .. healbalance)
echo("\nberrybalance = " .. berrybalance)

if healbalance == 1 then
	if currenthealth < siphealth then
            send ("sip health")
            healbalance = 0.5
        elseif currentmana < sipmana then
            send("sip mana")
            healbalance = 0.5
        elseif currentego < sipego then
            send("sip bromides")
            healbalance = 0.5
        end
    elseif healbalance == 1 then
        if currentmana < sipmana then
            send ("sip mana")
            healbalance = 0.5
        elseif currentego < sipego then
            send ("sip ego")
            healbalance = 0.5
        elseif currenthealth < siphealth then
            send ("sip health")
            healbalance = 0.5
        end
    elseif healbalance == 1 then
        if currentego < sipego then
            send ("sip mana")
            healbalance = 0.5
        elseif currenthealth < siphealth then
            send ("sip ego")
            healbalance = 0.5
        elseif currentmana < sipmana then
            send ("sip health")
            healbalance = 0.5
        end
    end

    if berrybalance == 1 and (currenthealth < berryhealth or currentmana < berrymana) then
        send ("outr sparkleberry")
        send ("eat sparkleberry")
        berrybalance = 0.5
    end
end
I know it's working through the parts where I echo as a check, since this is what I get as a screenshot:
Image

Why is it not autosipping, though? Gar.

EDIT: Changed screenshot to show it actually failing to sip despite having currentmana being below sipmana.
Last edited by Ilithyia on Fri Mar 19, 2010 7:32 pm, edited 1 time in total.

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

Re: ATCP demo scripts

Post by Vadi »

In your screenshot, it shouldn't need to - currenthealth is above siphealth.

Ilithyia
Posts: 43
Joined: Wed Mar 10, 2010 11:04 pm

Re: ATCP demo scripts

Post by Ilithyia »

Oh, the screenshot isn't capturing the part where the script failed to autosip. Later, I tried influencing a mob until my ego got below sipego and it failed to do anything. Despite the spam, I left the echos and display(status) up just to make sure that the variables and tables were updating timely and correctly, and they were. It just wasn't sipping.

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

Re: ATCP demo scripts

Post by naftali »

you have a variable for sip balance, yes? Do you have triggers to set balance on and off? Did you initialize the balances?

Ilithyia
Posts: 43
Joined: Wed Mar 10, 2010 11:04 pm

Re: ATCP demo scripts

Post by Ilithyia »

Yeah, here's a screenshot of my sip balance triggers:
Image

And here's my test to make sure it's working:
Image

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

Re: ATCP demo scripts

Post by naftali »

I think you're missing an if:

Code: Select all

if healbalance == 1 then[b]
   if currenthealth < siphealth then
            send ("sip health")[/b]
            healbalance = 0.5
        elseif currentmana < sipmana then
            send("sip mana")
            healbalance = 0.5
        elseif currentego < sipego then
            send("sip bromides")
            healbalance = 0.5
        end
    elseif healbalance == 1 then
        if currentmana < sipmana then
            send ("sip mana")
            healbalance = 0.5
        elseif currentego < sipego then
            send ("sip ego")
            healbalance = 0.5
        elseif currenthealth < siphealth then
            send ("sip health")
            healbalance = 0.5
        end
    elseif healbalance == 1 then
        if currentego < sipego then
            send ("sip mana")
            healbalance = 0.5
        elseif currenthealth < siphealth then
            send ("sip ego")
            healbalance = 0.5
        elseif currentmana < sipmana then
            send ("sip health")
            healbalance = 0.5
        end
    end
Between the two bolded lines, could be your indenting just has me confused but that might be it.

If that doesn't work, what do the error and debug consoles have to say?

Post Reply