Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Permanent Thieving Button! Whaaat?

DeeDee Member Posts: 10,447
edited June 2016 in UI Modding
Cleric/Thieves are at a slight disadvantage when it comes to thieving, because the Thieving button is sitting in the Special Abilities menu.

But what if it wasn't?

Bear in mind, this is a hacky solution; I'm only sharing it to show the functionality. This isn't going to be pretty, but it's functional.

Here's the code you'll be copying:

button { area 766 1 52 52 bam GUIBTACT frame 26 tooltip "Thieving" action "Infinity_PressKeyboardButton('a')" }

Change the 'a' to whatever the Thieving button is mapped to on your own game. (by default it's not mapped to anything, so you'll need to configure that however you're most comfortable either from BGEE.lua or from within the game.)

Here's where you'll be copying the above code to (on my system it's somewhere around line 10403):

button { area 710 1 52 52 actionBar 11 enabled "buttonArray:GetButtonEnabled(11)" tooltip lua "actionBarTooltip[11]" action "buttonArray:OnLButtonPressed(11)" actionAlt "buttonArray:OnRButtonPressed(11)" } [[[[ COPY IT HERE ]]]] }

Launch the game, get to the gameplay screen, and voila:


I said it wasn't going to be pretty. But there you have it.

Post edited by Dee on
Mr2150JuliusBorisovelminsterAncientCowboybrusmf2112inethRavenslightAdulcmk24jackjackCrevsDaakloliensemiticgodRik_Kirtaniya
«1

Comments

  • subtledoctorsubtledoctor Member Posts: 11,189
    Whoa. :smiley:

    But:
    1) Does it only show for cleric/thieves, or for all classes? Edit looks like for all classes.
    2) Even though the iPad game does not support keyboards, do iPads have this latent hotkey functionality? (I know iPads are still limited to 1.3, just asking for future information.)

  • DeeDee Member Posts: 10,447


    2) Even though the iPad game does not support keyboards, do iPads have this latent hotkey functionality? (I know iPads are still limited to 1.3, just asking for future information.)

    I would assume so, but I haven't tested it.

  • lefreutlefreut Member Posts: 1,422
    @Mr2150, does it work reliably ? From what I remember from my test with the previous version, the characters table is only filled when you open the inventory so you will not see the button until you open the inventory.

  • subtledoctorsubtledoctor Member Posts: 11,189
    Mr2150 said:


    enabled "string.find(string.lower(characters[id].class), string.lower('Thief'))"

    Basically this will only enable / show the button when the selected character has Thief in the class name - you can add it underneath the area line.

    Any reason you couldn't duplicate that line for "Cleric" and thus have the button only appear for cleric/thieves?

    (I know nothing about this lua stuff. Can it do nested conditionals like that?)

  • Mr2150Mr2150 Member Posts: 1,170
    From opening the game, and selecting the character directly I took these screens - only my first character and imoen are thieves. I didn't go into the character/record screens once.

    I went down the whole list and it worked fine.









  • Mr2150Mr2150 Member Posts: 1,170
    @subtledoctor yup ... change 'Thief' to 'Cleric / Thief' in the enabled line...

    You may need to play around with the spacing - eg is it 'Cleric/Thief' or 'Cleric /Thief' or 'Cleric/ Thief' or 'Cleric / Thief'...

  • DeeDee Member Posts: 10,447
    edited June 2016
    The limitation there is that it wouldn't work for kits, would it?

    EDIT: I updated the code in the first post to remove some crufty bits that were only there because I was copying the button from somewhere else. It should now only contain the pieces you need to get it working.

    JuliusBorisovlolien
  • Mr2150Mr2150 Member Posts: 1,170
    The enabled line looks for the word thief anywhere in the class name ... Thief kits would already have the button, no?

    You could also add additional conditions with 'or' in between them if you want to make sure all thieves regardless of class/kits have the option.

    enabled "string.find(string.lower(characters[id].class), string.lower('Thief')) or string.find(string.lower(characters[id].class), string.lower('Bounty Hunter')) or string.find(string.lower(characters[id].class), string.lower('Shadowdancer')) .... ...."

    smeagolheartJuliusBorisov
  • smeagolheartsmeagolheart Member Posts: 7,021
    The cleric thief missing thieving button has been a sore spot for the class for years... and now it's solved?? Awesome.

    JuliusBorisovjackjacklolienCrevsDaak
  • DeeDee Member Posts: 10,447
    Mr2150 said:

    The enabled line looks for the word thief anywhere in the class name ... Thief kits would already have the button, no?

    You could also add additional conditions with 'or' in between them if you want to make sure all thieves regardless of class/kits have the option.

    enabled "string.find(string.lower(characters[id].class), string.lower('Thief')) or string.find(string.lower(characters[id].class), string.lower('Bounty Hunter')) or string.find(string.lower(characters[id].class), string.lower('Shadowdancer')) .... ...."

    I'm mainly thinking about dual-class characters, especially if you have mod-based kits installed as well.

    It'd be great if you didn't have to hardcode each thief kit into UI.menu oh wait you could totally do that check with a .lua file never mind.

    Mr2150lolien
  • Mr2150Mr2150 Member Posts: 1,170
    edited June 2016
    EDIT: Removed the code as, as mentioned by @lefreut , usage of characters[id].class in the worldscreen is still unpredictable....

    Post edited by Mr2150 on
  • smeagolheartsmeagolheart Member Posts: 7,021
    Mr2150 said:

    You mean having a lua file with a table of all classes/kits that you want the button to appear for, with a function that checks that table, like this:

    Saving this as M_xbutt.lua:
    ExtraButton = { "Thief", "Bounty Hunter", "Assassin", "Swashbuckler", "Shadowdancer" } function ShowExtraButton() for i=1,#ExtraButton,1 do if string.find(string.lower(characters[id].class), string.lower(ExtraButton[i])) then return 1 else return nil end end end

    Then changing the enabled line to:

    enabled "ShowExtraButton()"

    Then if the user has any additional kits that they want the button to appear for they just need to add it to the table...

    So you could make a fighter kit (or sorceror or whatever) with thieving skills? There would be no skill selection so thieving skill point gains would have to be doled out automatically as part of level gain.

  • Mr2150Mr2150 Member Posts: 1,170
    This doesn't give the class the thieving skills... all it does is make the button appear. If they aren't able to use that button then nothing will happen.

  • smeagolheartsmeagolheart Member Posts: 7,021
    That's why I mentioned granting the skill points on level up (like rangers get stealth points for example)

  • Mr2150Mr2150 Member Posts: 1,170
    This is a UI mod only in that respect... so no, you cant add Sorcerer to the list and they will suddenly be able to start picking locks. The engine wouldn't let them.

  • Mr2150Mr2150 Member Posts: 1,170
    Found a couple of things to iron out... which I think is what @lefreut was mentioning earlier... don't use that code yet as it can be unpredictable.

  • Mr2150Mr2150 Member Posts: 1,170
    edited June 2016
    Unfortuantely I've had to remove that code as the usage of character references (characters[currentID] etc) in the worldscreen works maybe only 60% of the time...

    Just to confirm - Dee's original post stands and works fine... my suggestion didn't work as the worldscreen doesn't know which character is currently selected.

    JuliusBorisovlolien
  • smeagolheartsmeagolheart Member Posts: 7,021
    edited June 2016
    Mr2150 said:

    This is a UI mod only in that respect... so no, you cant add Sorcerer to the list and they will suddenly be able to start picking locks. The engine wouldn't let them.

    Yes by itself won't do anything I'm saying I felt that this (Dee's code / your adjustment) could be used to allow a thieving based kit in a mod that added a kit to Sorceror/Cleric/Fighter etc. Previously iirc it was possible to give kits for these classes thief skill points but there was no way for then to use their skills (no button).

  • DeeDee Member Posts: 10,447

    Mr2150 said:

    This is a UI mod only in that respect... so no, you cant add Sorcerer to the list and they will suddenly be able to start picking locks. The engine wouldn't let them.

    Yes by itself won't do anything I'm saying I felt that this (Dee's code / your adjustment) could be used to allow a thieving based kit in a mod that added a kit to Sorceror/Cleric/Fighter etc. Previously iirc it was possible to give kits for these classes thief skill points but there was no way for then to use their skills (no button).
    The button uses the hotkey functionality, and the hotkey doesn't work with a class that can't use thieving (that limitation is hard-coded, so there's no way around it).

    smeagolheartmf2112lolien
  • smeagolheartsmeagolheart Member Posts: 7,021
    Roger that, thank you for clarification

  • subtledoctorsubtledoctor Member Posts: 11,189
    Dee said:

    It'd be great if you didn't have to hardcode each thief kit into UI.menu oh wait you could totally do that check with a .lua file never mind.

    I'm still kinda dim on this UI modding stuff. Am I to understand that this is a file you drop in /override and the game will execute (or read, or whatever) the code in that file in place of / after the same code in the base game files....?

    Because, if that's the case, I could write a Weidu script to gather the names of every thief kit installed in the game (vanilla or mod-added) and then package them together like the list in Smeagholeart's quoted post above, add the rest of the code around it, and drop it into override. Meaning it would be a Weidu mod the add a main-screen thieving button for cleric/thieves. The player would just have to enable the hotkey for thieving. (Or could that be done with a lua file in /override too?)

    Maybe?

    If something like that is possible, and someone could write the lua code, I'f happily volunteer to write the Weidu and package it up as a mod.

    lolien
  • DeeDee Member Posts: 10,447
    @subtledoctor Very nearly. You would still have to manually update UI.menu to make use of the function from the Lua file (and in this case add the button that uses it).

    But once that editing has been done, yes, you should be able to use WeiDU to modify the table in the Lua file.

    lolien
  • AncientCowboyAncientCowboy Member Posts: 199

    Version 2.1 of EEUITweaks features a new implementation of Dee's Permanent Thieving Button. It's fully integrated visually with the Action Bar; and when disabled (by not having a hotkey assigned to Thieving), it is displayed in a disabled state rather than disappearing. The pictures below show the button enabled and disabled, respectively



    Enjoy!

    GrammarsaladAerakarlolienALIEN
  • subtledoctorsubtledoctor Member Posts: 11,189
    Bumping this... anyone know if this can work on mobile versions of the game??

    The mobile versions have no keyboard support, so no hotkeys... but this doesn't use a keyboard to invoke the hotkey mechanism. Maybe there is some kind of unused hotkey support hiding in the app...?

    I'll tag @Avenger_teambg and @JuliusBorisov in case the dev team can give a simple yes or no answer...

  • BubbBubb Member Posts: 668
    @subtledoctor
    I don't know about implementing it with hotkeys, but it would be possible to make the button automatically open the Special Abilities menu, search for the Thieving tooltip, and then press the corresponding button. Essentially it is a glorified macro, but it gets the job done. If you want I could mod that for you.

  • GusindaGusinda Member Posts: 1,551
    edited May 2018
    Hi @subtledoctor, I responded in a different post about the keyboard in Android, but I use an bluetooth keyboard and can access keyboard shortcuts etc.

    I suspect the only problem to get this working would be to assign a keyboard short cut in the first place (and without the external keyboard for those who don't). I also have Hacker's Keyboard installed which can be access from within the game and keys are functional. I can't try the Button due to being still on version 1.3.x .

    Having said that, once you set the keymap then it activates the button for use on screen. When you set the keymap, it writes this line to the baldur.lua:

    SetPrivateProfileString('Keymap Action','Thieving','110')

    I mapped to the N key just as a proof of concept (closest thing to my fingers at the time), which resulted in 110, but a better key could be mapped for something more permanent. If this line were to be added manually or as part of an install script, then I am sure the button would be usable.

    Gus

    Edit: Should have mentioned that as part of the proof, I then unassigned the key, exited the game, then added the line to the .lua and restarted. The button was active.

    lolien
  • MordekaieMordekaie Member Posts: 67
    Just for information :

    Dee's Permanent Thieving Button doesn't work on my setup (BGEE v2.3.67.3b + SoD + modmerge + lefreut's Enhanced UI v3.3 + EEUITweaks UI Mods Collection v2.9.1)

    The Thieving button is visible but stays inactive even with a cleric/thief character.


Sign In or Register to comment.