Treant Combat System

by Unknown

Back to Mechanic's Corner.

Razenth2009-02-23 21:25:56
Found a variable in Mush called treant_auto_forst, alongside treant_auto_frost.
Unknown2009-02-23 22:10:54
Your typo, not mine. Treant doesn't (yet) do any checking of the stuff between AUTO and ON/OFF, so you could do AUTO BRAIN OFF, and you'd get a variable called treant_auto_brain. biggrin.gif
Razenth2009-02-23 22:15:30
Oh hey, could there be an option to config if you have focus mind or not? It's easy to go in and manually config it, but it seems odd that its left out of the standard TCONFIG thing.
Unknown2009-02-24 01:39:54
I have another way that people disable things like that. It's a trade secret.
Unknown2009-02-24 20:29:05
Overall the installation went quite smooth. Good directions I felt, just have to follow them verbatim...so now to see if I did so...

First thing would be that for some odd reason when doing TCONFIG SKILLS, it recognizes Ninjakari and Acrobatics, however not Stealth. So I see an XML file for Stealth related triggers in the directory and I go ahead and import that manually. It seems others were installed, but this one was not, during the initial installation. Not sure if that should of happened or not. Regardless it does recognize the defenses when I call them or check for them. Now I just need to setup to have them be on automatically using the examples you provided. TCONFIG SKILLS still does not do the "Installing Stealth..." thing when it sees it like it does for Acrobatics and Ninjakari though. So perhaps that is a bug, or a bad installation on my part. Though pretty much everything else is working just fine.

Second thing would be the linebreaks. Now, I did have one present before installing as you stated in your requirements. However afterward it seems to have added a second. So I use your Prompt plugin, enabled and all. However, I still see the double linebreaks. I tried re-installing, re-starting MUSHclient, et cetera. Still the plugin does not seem to be working (if it was supposed to remove surplus linebreaks). Would it be alright if I remove one via CONFIG PROMPT REMOVE LINEBREAK? Like is it fine with just one linebreak, or does it secretly indeed need two?

I noticed the map provided by the plugin seemed to be offset from the right side of the window a decent amount, so I changed a few things in the plugin and it is looking quite nice now, great feature you added there. I had MAP macroed to my NumPad 5 key I used it so much.

Anyways, just those two questions. Thanks for the excellent system.
Unknown2009-02-24 20:35:24
The first part is a bug on my part, yes. I had Stealth under the skill specializations trigger instead of the main guild skills trigger, so it won't import automatically in 1.17, unfortunately, but it's fixed for 1.18 now.

If you have MUSHclient converting GA/EOR to CR/LF, you don't really need the linebreak in the game, too.

Odd that your map wasn't all the way in the top-right corner, as it always is for me, but you might have something setup a little differently than I do.
Unknown2009-02-24 21:40:42
Ohh, so no big deal there then for the Stealth import.

As for the GA/EOR thing, I did have it checked since it said to in the plugin from what I saw. So it looks like I will be fine just removing one of the linebreaks using Lusternia's commands.

Also, as for the map, I might have had something funky selected, but here is what I noticed:

I run my world in Consolas 12 point. I do prefer 10 point, but I seemed to miss stuff if it was that small, just due to how fast things scrolls by. The InfoBox gauges do perfectly well at the bottom right, against the corner. However the map, while aligned to fit snuggly into the top right based on your code, works off of Lucida Console 8 point.

Anyways, it seemed the map was only taking up 50% of the assigned area's width, and perhaps 75% of the assigned area's height (assigned area visible once transparency was removed temporarily to see what was going on). So I just changed it to use Consolas 10 point, and counted the columns and rows that the MAP function uses in its display (29 x 17) and then used those plus 1 column and row for the character width/height formulas you used to basically make a kind of grid system for size.

However, even doing that it seemed to add too much empty unused width, so I just wrapped the width portion in some parenthesis and made it 75% the width it previously was.

Now it shows up with one column and one row extra unused space (to offset it from the window edge and aid in readability) on the right and bottom. Fits perfectly. Should always work unless the number of columns and rows the map uses, changes.

Here is the section of code from "treant_plugin_map.xml" that I worked with, with the lines I changed denoted by " -- Alyks":

CODE
  -- If we haven't already created the map window, do so now
  if not self.win then
    WindowCreate("treant_map", 0, 0, 300, 300, 6, 1, ColourNameToRGB("black"))
    WindowFont("treant_map", "map", "Consolas", 10, false, false, false, false) -- Alyks

    self.width = (WindowFontInfo("treant_map", "map", 7) * 30) * 0.75 -- Alyks
    self.line_height = WindowFontInfo("treant_map", "map", 1)

    -- Re-create the window to fit the text using the chosen font
    WindowCreate("treant_map", 0, 0, self.width, self.line_height * 18, 6, 1, ColourNameToRGB("black")) -- Alyks
    WindowFont("treant_map", "map", "Consolas", 10, false, false, false, false) -- Alyks
    WindowShow("treant_map", true)

    self.win = true
  end

  WindowRectOp("treant_map", 2, 0, 0, self.width, self.line_height * 18, ColourNameToRGB("black")) -- Alyks


Before Pic (using original 1.17 treant_plugin_map.xml):



After Pic (using modified treant_plugin_map.xml):



Anyways, figured this might help you out by showing you, though if it works for everyone else (and I have not read any complaints with it thus far) it likely was some peculiar setting of mine that I am unsure about. If I upgrade to a new version will that XML file be possibly overwritten? Want to know in case I need to just save a backup and make the small changes each time.
Unknown2009-02-24 22:03:27
Weird, but it still doesn't make any sense because the map uses its own font and bases its size off of that font and not your world font...

If you upgrade, you may overwrite the plugin with the new file, depending on how you did your plugins and how you manage your upgrade. I don't anticipate any changes to the map plugin in the foreseeable future, so you should be safe putting yours somewhere and loading it from your directory just to be sure it's yours and not mine that you're using each time.
Unknown2009-02-25 16:48:37
I tried following the instructions in "treant_install.txt" when setting up my defenses. I ended up with this code in my personal LUA file it uses for scripting:

CODE
my_sip = {
   = function (max) return max * 0.25 end,
   = function (max) return max * 0.5 end,
   = function (max) return max * 0.5 end
}

my_defs = {
   = { "nightsight" },
   = { "sneak", "bracing" }
}

my_defup = {
   = php:Table(),
   = php:Table(),
   = php:Table(),
   = php:Table()
}

my_defup = "nightsight"

my_defup = "sneak"
my_defup = "stealth bracing"

defs:def_up(my_defup)

require "treant"
treant:Init()

require "gui"
gui:Init()


However, it gives the following error:

CODE
Run-time error
World: Alyks
Immediate execution
:13: attempt to index global 'php' (a nil value)
stack traceback:
        :13: in main chunk
Error context in script:
   9 :   = { "sneak", "bracing" }
  10 : }
  11 :
  12 : my_defup = {
  13*:   = php:Table(),
  14 :   = php:Table(),
  15 :   = php:Table(),
  16 :   = php:Table()
  17 : }


I am not familiar with the syntax regarding php and tables, however does there need to be a name I choose, in the parenthesis of the php Table() function? If so, any, or a specifically needed one? Thanks.
Gregori2009-02-25 17:14:38
add this:

require "php"
my_defup = {
= php:Table(),
= php:Table(),
= php:Table(),
= php:Table()
}
Unknown2009-02-25 18:35:20
Thanks, that cleared it up. Seems if I do require "defs" before I start working with defenses in the script it gets the php script anyway. Plus it needed to require the defs script afterward anyway. New issue though is the following error:

CODE
Run-time error
World: Alyks
Immediate execution
.\\defs.lua:195: attempt to index global 'display' (a nil value)
stack traceback:
        .\\defs.lua:195: in function 'def_up'
        :26: in main chunk


The defenses section of my script below:

CODE
require "defs"

my_defs = {
   = { "nightsight" },
   = { "sneak", "bracing" }
}

my_defup = {
   = php:Table(),
   = php:Table(),
   = php:Table(),
   = php:Table()
}

my_defup = "nightsight"

my_defup = "sneak"
my_defup = "stealth bracing"

defs:def_up(my_defup) -- Line 26


The section in defs.lua where the error points to:

CODE
-- Put up defenses!
function defs:def_up(these)
  -- Copy the table properly, skipping defenses that are already up
  self.todo = {}
  for k,v in pairs(these) do
    self.todo = php:Table()
    for d,c in v:pairs() do
      if not defs:has(d) then
        self.todo = c
      end
    end
  end

  for bal,list in pairs(self.todo) do
    for d,c in list:pairs() do
      display.Debug("TODO + " .. d .. " -> " .. c .. " (" .. tostring(defs:has(d)) .. ")") -- Line 195
    end
  end

  defs:scan()
  Send("")
end


I am assuming it is something I am doing wrong in my script since this likely would have been reported and fixed already if an issue in defs.lua. What it is though is what I am trying to figure out. It for some reason has an issue with the display function being called in that line? I also do not have debug on, so should it be even trying to call that anyway?
Unknown2009-02-25 19:22:27
QUOTE (treant_install.txt)
Putting up defenses requires making an alias with your own custom table to map
defense names to the commands for putting each one up.
Unknown2009-02-25 19:34:46
Ohh, I was figuring the my_defs thing was that. Oops.
Unknown2009-02-27 16:48:13
ok, this one I really havesn't figured out yet.

I just uploaded 1.17, and the system says "» Initialized version 1.17" when I start it up.

My map in that annoying way like on nexus, where it bumps up every time you move, It's not in the upper right courner like before

also when I do "/treant:Install" I get this

Run-time error
World: Treant
Immediate execution
.\\treant.lua:132: bad argument #1 to 'input' (treant_events.xml: No such file or directory)
stack traceback:
: in function 'input'
.\\treant.lua:132: in function 'Install'
:1: in main chunk

I put in the /treant:Install() just the way it is on the instructions page.

I did uninstall much and reinstall it so it would be easier to install 1.17, and I re check everything in the instrusctions to make sure it's all in there
Unknown2009-02-27 22:24:38
QUOTE (Shadow Aes @ Feb 27 2009, 10:48 AM) <{POST_SNAPBACK}>
ok, this one I really havesn't figured out yet.

I just uploaded 1.17, and the system says "» Initialized version 1.17" when I start it up.

My map in that annoying way like on nexus, where it bumps up every time you move, It's not in the upper right courner like before


Did you load the map plugin?
Unknown2009-02-28 01:27:52
yes it's in the world/plugins
Unknown2009-02-28 01:29:14
Some people put these files in all sorts of other directories, which is completely unnecessary and often gets you into trouble when you can't find them or load them. Fix your working directory, and my guess is that your problem is solved.
Esano2009-02-28 01:40:36
QUOTE (Shadow Aes @ Feb 28 2009, 12:27 PM) <{POST_SNAPBACK}>
yes it's in the world/plugins

It has to be more than just in the folder. Go to File -> Plugins -> Add, and select it.
Unknown2009-02-28 01:43:15
The error posted has nothing at all to do with plugins. It's nice that you try to help, but you're going in a different direction there...
Unknown2009-02-28 03:27:30
QUOTE (Esano @ Feb 28 2009, 01:40 AM) <{POST_SNAPBACK}>
It has to be more than just in the folder. Go to File -> Plugins -> Add, and select it.



it worked thanks!!