Assistance needed for cube recharge script

KagatoKagato Auckland, New Zealand
What I want to do ideally is come up with something so that when you have a powerstone wielded, it does an echo of how much power is left, or a mini-gui with the percentage left so I can keep track of them without having to probe the stone every so often,  or alternately a script that when a stone reaches 2% reserves, it automatically unwields and sticks it in my backpack.  Everything I have tried so far has been too spammy. x_x
Never put passion before principle.  Even if you win, you lose.

If olive oil comes from olives, where does baby oil come from?

If vegetarians eat vegetables, what do humanitarians eat?

Comments

  • XenthosXenthos Shadow Lord
    Why not just have a thing that does a counter from when you start enchanting (make an alias to start enchanting, that first probes the powerstone, and then begins enchanting after setting a variable with the percentage in it)?  Then just have it decrement a counter every time the enchanting line ticks, breaking the enchanting when the counter reaches zero (just set the math so that it is one less than using up the powerstone entirely).
    image
  • KagatoKagato Auckland, New Zealand
    edited October 2017
    edit: misread the post.  Worth a shot.  Need to find a way to gag the probe of the powerstone though - that is one thing that makes most of my script attempts so spammy so far.
    Never put passion before principle.  Even if you win, you lose.

    If olive oil comes from olives, where does baby oil come from?

    If vegetarians eat vegetables, what do humanitarians eat?
  • edited October 2017
    Counter, not timer.

    on wield powerstone:
      p powerstone
    on powerstone power line
      psctr = <%1>
      enchant
    on enchant line:
      psctr -= 5;
      if psctr <= 5:
        unwield powerstone
        put powerstone in pack
        wield powerstone
    Forum Avatar drawn by our lovely Isune.
  • ShaddusShaddus , the Leper Messiah Outside your window.
    Ianir said:
    Counter, not timer.

    on wield powerstone:
      p powerstone
    on powerstone power line
      psctr = <%1>
      enchant
    on enchant line:
      psctr -= 5;
      if psctr <= 5:
        unwield powerstone
        put powerstone in pack
        wield powerstone
    Not a bad idea, but would this check to make sure the powerstone you put into your pack is the one you just unwielded, and not a random one from your inventory?
    Everiine said: The reason population is low isn't because there are too many orgs. It's because so many facets of the game are outright broken and protected by those who benefit from it being that way. An overabundance of gimmicks (including game-breaking ones), artifacts that destroy any concept of balance, blatant pay-to-win features, and an obsession with convenience that makes few things actually worthwhile all contribute to the game's sad decline.
  • edited October 2017
    Edit: Revised my post for a more thorough answer!

    I can't imagine NOT probing the powerstones and expecting accuracy. You'll need GMCP to have the correct ID at all times. My solution is not the most eloquent, it's just kind of banged out real quick, but I think it gets the job done!

    Here's the screencap for the setup of the trigger and relevant settings (multiline AND trigger with a 4 line delta)


    Here are the trigger lines for copy+paste:
    
    ^The powerstone is a perfect sphere, smooth and hard as a diamond\. Colours swirl about upon its surface in an exotic patina of hues and shades\. Vibrating with an inner energy, the powerstone holds an inner power all its own\.$
    ^It has \d+ months of usefulness left\.$
    ^It weighs 4 ounce\(s\)\.$
    ^The powerstone is at (\d+)\% efficiency\.$
    ^It has the following aliases: powerstone, stone, gem\.$


    Here's the code:
    
    currentpowerstone = currentpowerstone or 0
    
    if currentpowerstone == 0 then newpowerstone() end
    local pwrleft = multimatches[4][2]
    
    for i=0, 5 do
      moveCursor(0, getLineNumber() - 1)
      deleteLine()
    end
    deleteLine()
    
    echo("\nPowerstone: ".. pwrleft.. "%")
    
    if tonumber(pwrleft) <= 2 then newpowerstone() end
    
    function newpowerstone()
    	local nextstone = 0
    	-- does gmcp have our inventory?
      if gmcp.Char.Items.List.location == "inv" then
    	  -- check all the items in our inventory
    	  for k, v in pairs(gmcp.Char.Items.List.items) do
    		  -- is it a wielded powerstone?
    		  if v.name == "a glowing powerstone" then
    			  if string.find(v.attrib, "l") then
    					currentpowerstone = v.id
    					if currentpowerstone == 0 or pwrleft >= 2 then return end -- if we actually have power in it, but weren't aware of the ID of our current powerstone (like when we first launch Mudlet or reload settings) then we don't want to get rid of our current powerstone, so we're exiting this function
    			    sendAll("unwield ".. v.id, "put ".. v.id.. " in pack", false) -- get rid of it!
    			  else
    				  nextstone = v.id
    				end
    			end
    		end
    	-- gmcp didn't see our inventory, going to ask for gmcp data and retry in one second
    	else
        echo("> Trying to retrieve GMCP data.\n> Re-attempting in one second.")
        sendGMCP("Char.Items.Inv \"\"")
        send("\n", false)
    		tempTimer(1, [[ send("probe powerstone") ]] )
    		return
    	end
    	
    	send("wield ".. nextstone)
    	currentpowerstone = nextstone
    end
    
  • edited October 2017
    Can I ask why you don't just want to use the stone up? What's the game plan with a bunch of 2% powerstones? Or when you have 50 2% powerstones in your backpack?

    IMO, gagging in Mudlet is very complicated for multiline/AND triggers. That was the majority of what I spent time on.

    edit: if ianir says everything takes 5% then I'd go with that :wink: I also can't recall if probing takes you out of enchanting. I quit being one the other month so I couldn't test real easy.
  • XenthosXenthos Shadow Lord
    Shaddus said:
    Ianir said:
    Counter, not timer.

    on wield powerstone:
      p powerstone
    on powerstone power line
      psctr = <%1>
      enchant
    on enchant line:
      psctr -= 5;
      if psctr <= 5:
        unwield powerstone
        put powerstone in pack
        wield powerstone
    Not a bad idea, but would this check to make sure the powerstone you put into your pack is the one you just unwielded, and not a random one from your inventory?
    As long as you WIELD POWERSTONE to start it (and not WIELD ID#), and the game hasn't crashed between wielding and unwielding, then it'll get the right one (because you're working with the first powerstone in your inventory the entire time).

    Wielding doesn't move it to the back of your inventory stack unlike dropping it.
    image
  • KagatoKagato Auckland, New Zealand
    Chirbi said:
    Can I ask why you don't just want to use the stone up? What's the game plan with a bunch of 2% powerstones? Or when you have 50 2% powerstones in your backpack?

    IMO, gagging in Mudlet is very complicated for multiline/AND triggers. That was the majority of what I spent time on.

    edit: if ianir says everything takes 5% then I'd go with that :wink: I also can't recall if probing takes you out of enchanting. I quit being one the other month so I couldn't test real easy.
    Because depleted powerstones can be used in trade goods (figurines, designs that require powerstones, etc) - I know that powerstones aren't extremely expensive, but I'd rather use the powerstone to charge a cube first then use it when it is almost depleted as a commodity.
    Never put passion before principle.  Even if you win, you lose.

    If olive oil comes from olives, where does baby oil come from?

    If vegetarians eat vegetables, what do humanitarians eat?
  • That makes a lot of sense! Thanks for explaining. They have a super slow decay so easy to horde.
  • KagatoKagato Auckland, New Zealand
    Also going to give the new code a try - changed the threshold from <=2 to <=4 though, as an extra safety measure.  I'm not too fussed over a single pulse worth of charges and I sometimes am given partially used stones, which could screw with things a bit.
    Never put passion before principle.  Even if you win, you lose.

    If olive oil comes from olives, where does baby oil come from?

    If vegetarians eat vegetables, what do humanitarians eat?
  • AeldraAeldra , using cake powered flight
    Chirbi said:
    Can I ask why you don't just want to use the stone up? What's the game plan with a bunch of 2% powerstones? Or when you have 50 2% powerstones in your backpack?

    IMO, gagging in Mudlet is very complicated for multiline/AND triggers. That was the majority of what I spent time on.

    edit: if ianir says everything takes 5% then I'd go with that :wink: I also can't recall if probing takes you out of enchanting. I quit being one the other month so I couldn't test real easy.

    probing doesn't if memory serves. I used to probe cubes a lot when I was trying to figure out how far the enchanting process was already done. Also TIL how an AND trigger works. Useful.
    Avatar / Picture done by the lovely Gurashi.
  • Can't you just set a toggle in game that prevents you from enchanting without a powerstone wielded containing enough power? 
  • XenthosXenthos Shadow Lord
    If you have a powerstone with 5% on it and do something that takes 5%, the powerstone will be used up and crumble.  The intent of this request is to save the powerstones from crumbling.
    image
  • KagatoKagato Auckland, New Zealand
    edited December 2017
    Well, I finally got around to tinkering with my script and got it working - it is a much more crude, basic setup than the one that Chirbi offered  (I don't know why, but I wasn't able to get it to work), my new script works for the intended purpose.  Spits out the power level of the stone each time it pulses, then when it hits 2.5% it unwields, puts the stone in the backpack and wields the next stone.

    Trigger lines - all perl regex:
    ^The powerstone is a perfect sphere, smooth and hard as a diamond\. Colours swirl about upon its surface in an exotic patina of hues and shades\. Vibrating with an inner energy, the powerstone holds an inner power all its own\.$
    ^It has \d+ months of usefulness left\.$
    ^It weighs 4 ounce\(s\)\.$
    ^The powerstone is at (\d+)\% efficiency\.$
    ^It has the following aliases: powerstone, stone, gem\.$

    Script:

    local pwrleft = multimatches[4][2]
    local linenumber = matches[1-5]
    for i=0, 5 do
      moveCursor(0, getLineNumber() - 1)
      deleteLine()
    end
    deleteLine()
    echo("\nPowerstone: ".. pwrleft.. "%")
    if tonumber(pwrleft) <= 2 then
       send("unwield powerstone;put powerstone in backpack;wield powerstone;enchant cube")
      echo("NEW POWERSTONE IN USE!")
      else end
      

    I also have a second trigger that is just

    ^You continue enchanting an energy cube, which pulsates with an inner light\.$  (perl regex)

    with the output send("probe powerstone") to keep it ticking over.

    As can be expected, it will stop by itself when a cube is full (it won't automatically change cubes - not going to automate that part for obvious reasons) and can be stopped by pretty much anything that breaks concentration.
    Never put passion before principle.  Even if you win, you lose.

    If olive oil comes from olives, where does baby oil come from?

    If vegetarians eat vegetables, what do humanitarians eat?
Sign In or Register to comment.