MMOMinion

Full Version: Buy House Assister
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
This script is intended for abandoned houses left on a random lockout and will iterate through the menus for you.

It's intended to be used as a Shortcut User Function. Minion Button > Shortcuts > User Functions (bottom) > New, name it w/e you want, like BuyHouse, and paste the code below as the function.

You then have to create a keybind or a Button Bind, whichever you prefer. This function will act as a toggle, first use = enabled, 2nd use = disabled, etc.

Just making a small edit till Kali gets on next. ~HusbandoMax
Code:
local delay = 250 --Delay between purchase attempts, 1000 is 1 second
local buytype = 0 --0 is Private Individual, 1 is Free Company, 2 is Relocation...

if BuyHouseVar == nil then
       BuyHouseVar = true
       BuyHouseStep = 0
       BuyHouseLast = 0
       BuyHousePushButton = 24
       if GetGameRegion() == 1 then BuyHousePushButton = 25 end
else
       BuyHouseVar = not BuyHouseVar
end

function BuyHouseFunction()
       d("BuyHouseStep: "..tostring(BuyHouseStep))
       if BuyHouseVar and TimeSince(BuyHouseLast) > delay then
               local PlacardID = 0
               local el = EntityList("nearest,contentid=2002736")
               if table.valid(el) then
                       for k,v in pairs(el) do
                               PlacardID = v.id
                       end
               end

               if BuyHouseStep == 0 then
                       if IsControlOpen("HousingSignBoard") then
                               BuyHouseStep = 1
                       else
                               Player:SetTarget(PlacardID)
                               Player:Interact(PlacardID)
                       end
               end
               if BuyHouseStep == 1 then
                       if IsControlOpen("SelectYesno") then
                               BuyHouseStep = 3
                       elseif IsControlOpen("SelectString") and not IsControlOpen("HousingSignBoard") then
                               BuyHouseStep = 2
                       elseif IsControlOpen("HousingSignBoard") then
                               local ctrl = GetControl("HousingSignBoard")
                               if ctrl:GetRawData()[1].value.A == 1 then
                                       ctrl:PushButton(BuyHousePushButton,2)
                               end
                       end
               end
               if BuyHouseStep == 2 then
                       if IsControlOpen("SelectYesno") then
                               BuyHouseStep = 3
                       elseif IsControlOpen("SelectString") then
                               GetControl("SelectString"):Action("SelectIndex",buytype)
                       elseif IsControlOpen("HousingSignBoard") then
                               BuyHouseStep = 1
                       end
               end
               if BuyHouseStep == 3 then
                       if IsControlOpen("SelectYesno") then
                               UseControlAction("SelectYesno","Yes")
                       elseif Player:GetTarget() == nil then
                               BuyHouseStep = 0
                               BuyHouseLast = Now()
                       end
               end
       end
end
RegisterEventHandler("Gameloop.Update", BuyHouseFunction)
works great thank you kali!
thanks! been looking for something like this.
Updated the code in the OP.

If the user wasn't in an FC, and had no previous homes before, then there is no select string menu and would lock up in step 1. It should now work properly for those users.

Let me know if you encounter any other bugs, I won't mind taking the time to fix it if you're having issues with something.
Thanks Kali! I was looking for something like this! But im a noob in coding so i need to ask!

If i want to use this scrip for private plot, must i change an integer or anything? Cause i have an FC house but not a private and dont want to relocate the FC by mistake.
bump! is this safe for FC leaders?
I've binded this code to a shortcut but nothing seems to happen.
Do I need to manually open the Residential District Aethernet?
Also, how would I know if the code is working?

Thanks for the code Kali ! Keep up the great work!
This used to work great! But now it no longer spams the target. It works once, then never again.
dosent work anymore, chat spams string errors
The code will go through the buy process but then hangs at the Placard screen so I have to click "Purchase land" then it does everything and loops back around again.  am I missing something?
Pages: 1 2 3 4 5 6