I am having some issues while writing my script. When I use APIs like tpt.drawLine to draw on the screen, their layer priority seems to be lower than the window provided by the API, causing me unable to draw on the window. Can someone provide me with a solution? Thank you.
Here's an example to demonstrate my problem:
local newWindow = Window:new(250, 150, 200, 200)
function Cdraw()
tpt.drawline(152, 170, 205, 334, 0, 255, 0, 255)
tpt.drawline(205, 334, 378, 334, 0, 255, 0, 255)
tpt.drawline(378, 334, 430, 170, 0, 255, 0, 255)
tpt.drawline(430, 170, 291, 68, 0, 255, 0, 255)
tpt.drawline(291, 68, 152, 170, 0, 255, 0, 255)
end
tpt.register_step(Cdraw)
interface.showWindow(newWindow)
I also have a question about how to delay execution. Whenever I use tpt.screenshot, it always takes the screenshot before the window is closed, which causes the screenshot to be obscured by the window.
For example:
local T_Button = Button:new(100, 30, 80, 15, "Screenshot")
T_Button:action(
function()
interface.closeWindow(Mainwindow)
tpt.screenshot(1,0)
end
)
Finally, I hope my machine translation doesn't make it difficult for you to understand it.
Thanks for the method, I'll go and use it.
So you mean that using tpt.screenshot like this has no way to screenshot the game interface, right?
I used your advice but still encountered problems. Here is the code used in my test script and the results when run on Android tpt
local Mainwindow = Window:new(50, 50, 525, 300)
function draw()
tpt.drawline(152, 170, 205, 334, 0, 255, 0, 255)
tpt.drawline(205, 334, 378, 334, 0, 255, 0, 255)
tpt.drawline(378, 334, 430, 170, 0, 255, 0, 255)
tpt.drawline(430, 170, 291, 68, 0, 255, 0, 255)
tpt.drawline(291, 68, 152, 170, 0, 255, 0, 255)
end
Mainwindow:onDraw(draw)
interface.showWindow(Mainwindow)
Cracker1000:
As the big title suggests, this script (or lua mod) allows you to use some of the most widely used features and modes from the PC version of the game on android. Below is the list of stuff it offers.
*Ability to change brush shape and size
*Tools: Line tool (also supports changing fan wall strength), Flood fill and box draw tool.
*Toggles for debug mode, performance, cross hair, resetting spark and pressure.
*Simulation tools: Allows you to use options like redo, undo and advance simulation frame by frame.
*Other features not listed here.
Latest version: v3.0
Steps to install/ update the script:
Recommended way:
In order to install the script you will have to open the console (second button from top on right corner) and just type this "tpt.getscript(214,"autorun.lua",1)" the bold text without quotes and then enter it.
You will see a new button on the right hand side. Click it to open the script menu.
Installing using script manager:
If you have script manager installed on your android port, you can search for PC controls in the manager and install the script from there too.
Do give suggestions or feedback, there'sa dedicated feedback button provided in the script too. Thanks to @jacob1 for helping with fan tool.
Yes, Android tpt is a bit different. But when I was looking through this script I noticed that it also uses this drawing API
Here are some snippets of what I found
local function selectedbrush()
brushheight:value(tpt.brushx)
brushwidth:value(tpt.brushy)
if ren.debugHUD() == 1 then
gfx.drawText(315,261,"ON",35,255,35,255)
else
gfx.drawText(315,261,"OFF",255,35,35,255)
end
Omitted .....
--Draws graphics when menu is open
brushmenu:onDraw(selectedbrush)
--End of script