Trying to fix an auto farming script for a mobile game - lua

I found a 5 month old lua script to automatically farm currency and items in a mobile game called Soda Dungeon, the script was finicky when I found it and wouldn't work properly so I'm trying to fix it with very little lua experience.
Here is the code Ive edited: http://pastebin.com/U9Ymej0z
it runs fine until it tries to start the dungeon and I get this error:
Runtime error: com.appautomatic.ankulua.f:
Can't find dungeon_level_up.png
stack traceback:
[C]: in function 'continueClick'
?: in function <?:291>
(tail call):?
/storage/extSdCard/soda_dungeon/main.lua:
217: in function 'main'
/storage/extSdCard/soda_dungeon/main.lua:
239: in main chunk
Any help is greatly appreciated.

I don't know anything about Ankulua but a quick session with our best buddy google gave me this:
http://ankulua.boards.net/thread/13/advanced-methods
http://ankulua.boards.net/thread/6/objects-methods-introduction-sikuli-compatible
They give those functions:
continueClick(x, y, xRandom, yRandom, times)
continueClick(PSMRL, times [,timeout])
They say continueClick will click on a position given by x,y or PSMRL, which will resolve in a postion as well.
You enter a string that contains an image name.
I assume the message
Can't find dungeon_level_up.png
Is rather an exception text of some find(PS) function inside Ankulua than a problem with finding an image file. Replace that image name with some coordinates and check what is happening.
I would not trust that function call in your script as the author of that script added a comment that he does not know what continueClick returns. So maybe he did not know how to use it as well.
The documentation says:
There is no return value.
Btw, the author of Ankulua offered support via mail. So why don't you ask him? I'm sure he'll be of better help than anyone here.

let me offer you another alternative method, just a few simple click you and drag
It doesn't require root,
background service Installation can be found at the following
hXXp://123autoit.blogspot.tw/2016/08/123autoit-non-root-daemon-service.html
currently only works on ARM
for Android 5.0+
hXXp://play.google.com/store/apps/details?id=com.autoit.nonroot&hl=en
for Android 4.2~4.4
hXXps://play.google.com/store/apps/details?id=com.autoit.nonroot.legacy&hl=en
feel free to send me message to ask for question
here is what it can do
check out the blog, it contains tutorials, and video demo
http://123autoit.blogspot.tw/
Hope everything works out for you,
cheers

Related

My lua code produces the error "Object tried to call nil" when trying to check if a player has a certain trait [PZ]

I'm attempting to mod a game I've been playing recently, and I've encountered an error when writing some code that adds a new mechanic. The problem itself isn't very complicated, but I can't seem to figure out what the solution is in this context. I'm pretty new to coding, especially with lua, so I apologize if the solution is really obvious. I've looked around for some answers, but again, nothing I can find seems to help me in this specific context. The game I'm trying to mod is called Project Zomboid, if that helps.
When attempting to start the game with the mod enabled, the error "Object tried to call nil in isBloodthirsty" pops up. Here's the snippet of code that's causing the error:
local function isBloodthirsty(player)
if player:getDescriptor():getTrait() ~= "bloodthirsty" then
return false else
return true
end
end
Ignoring how poorly written it is, the code was supposed to check if the player had a certain trait, and if so, then set the value isBloodthirsty to true. I think the error is caused by lua not recognizing the value "bloodthirsty", but I'm not sure what I should put instead. If anybody has an idea of what I'm doing wrong, I'd greatly appreciate some help. If it's helpful, I can post the rest of the code.
Thanks to all the great help from the stack overflow community, I managed to figure out what my problem was. The code I had written wasn't working because lua didn't recognize "bloodthirsty" as a valid trait string. My solution was to mix up the code a bit and frame the trait as a profession instead (a profession is kind of like a collection of traits within the game). The following code worked:
local function bloodthirstyStart(player)
if player:getDescriptor():getProfession() ~= "bloodthirsty" then
return
end

RE: Mail Merge Google Sheet - Default subject line & Time trigger

Thanks in advance for your assistance here. I really appreciate it!!
I have built a script using the template here: https://developers.google.com/workspace/solutions/mail-merge
...And it's awesome. Working perfectly and solving a big problem for me!!
I have 2 problems I need to fix, and I need your help, please!!
Problem 1: Can I use a column (or cell reference) as a default "subjectLine" rather than it be user input each time the script is run?
Problem 2: Once Problem 1 (above) is solved, I'd like to trigger the script to automatically run every 15 minutes, continuously.
Any tips/scripts/pointers would be awesome. I am quite new to coding so have tried to dig up how to replace the user input piece of code with a default value for the subject line, but I can't figure it out. And only once this is done, can I then start to try and get code working for the second problem - so I'm stuck on both counts.
Thanks again!! Kind regards, Tom

Why using List<T> as stack returns _GrowableList

I am new to Flutter and Dart. I have implemented list as stack reference for code here. I am calculating path from one node to other in graph. Problem with code is it returns _GrowableList on which is either empty or null but my GetAnswer do returns a correct list(checked while debugging). Why it automatically converts it into growable, How can I have my normal list?
Here is snippet of code where I am passing my graph start node and end node to instance of GetAnswer and storing back result in path variable.
That's the real internal type for the list you created. However, it shouldn't really look like this in the tooltip, this is how it looks for me:
If you can provide code that reproduces showing the tooltip like that, I'd love to take a look. Please open a bug in GitHub.
(It's possible you're on v2.11 of Dart Code - if so, please update to v2.12 and this should be improved)

How to use AwesomeWM signals in lua?

I want to execute a method when one of my wibox.widget.textbox widgets is clicked, and according to the documentation I should use the button::press signal.
However I didn't find anything about these signals, I can't even figure if it is a native lua thing of if they are tied with AwesomeWM.
Thus, I don't know how to implement them.
Any help would be appreciated. (Please note that I have barely no knowledge in lua).
Sample code:
mywidget = wibox.widget.textbox()
mywidget:set_align("right")
-- I want to execute awful.util.spawn_with_shell("pavucontrol") if the widget is clicked
Probably something like this. The button::press signal needs a callback which is called with the parameters listed in the docs you linked. Untested:
local box = wibox.widget.textbox(...)
local box_pressed = function(lx, ly, button, mods, find_widgets_result)
// some code ...
end
box:connect_signal("button::press", box_pressed)

Get all current forms via code

I can identify (find) an element with a certain RanoreXPath via Ranorex Spy, but not via Ranorex API.
Is there a method to output all current \forms on the computer to be able to debug the problem?
var FormElementList = Host.Local.Find("/form");
foreach (var formElement in FormElementList) {
Report.Info(formElement.GetPath(PathBuildMode.Default, Ranorex.Host.Local).ToString());
}
By identify, do you really mean find?
When I encouter problems with troubleshooting an issue, I usually insert Report.Screenshot and Report.Snapshot at strategic places in recordings (or user code).
When Report.Screenshot has no element specified, it captures a screenshot of the entire desktop which can be useful (when tests are executed unattended).
Report.Snapshot does however need an element (/form could be used as suggested by RanorexPro), but if your XPath is incorrect, this won't help much...
Hoping this gives you ideas...

Resources