Lua script for iOS getColors within range? - ios

I am trying to capture the pixel color of a specific letter in a font within an iOS app. I'd then use that color in an if/then statement to determine the next action of my script. I'm finding no easy way to determine if the color/colors I'm finding are the right ones. Here's my current process: I start recording my inputs and continuously click around the letter. I end up with something like touchdown(123,456). I change that to alert(getColor(123,456)) and run, which produces a popup that tells me the color such as 3094841 (not sure why the colors are in numeric format, but they are). I do this for each touchdown line that is captured. The problem is, I don't know an easy way to determine which color is the small letter I'm trying to tap.
Is there a lua function that will capture and display a range of colors between 2 points? If there were, I could see the commonality of all of the colors within the 2 points and make at least an educated guess as to which is the color in the font. Or even more useful - is there a tool I can use to type in the color I'm getting back and have it display the corresponding color, so I can compare them. That'd be the easiest. Hope this makes sense. Any help would be awesome. In case it matters, I'm using Autotouch 8 on an iPhone 5.
TIA

I use this function often in my games.
I find the easiest way to get a color you want to execute every single time is to take a snap of the screen you're checking and then use the helper on getColor(x, y)
And you can use this to alert your color.
local color = getColor(x, y)
alert(color)
-- You can also use:
log(color)--this one keeps it in your log in case you can write it down immediately.
To use this in an if/then statement
function = namedfunction()
local color = getColor(x, y)
if color == YOURCOLOR then
else
end
end
namedfunction();
Note that I have the iPhone 5 iOS 8.3 and I have the most recent AutoTouch from Cydia. If you don't have the helper when you're scripting it might be worth it to check if Cydia offers a capatable version.
Edit: I am running version 3.5.3-8 of Autotouch.

Related

How can I get the CIAttributedTextGenerator filter to break onto multiple lines?

I'm working on an app that overlays text onto an image. We want to be able to constrain the width of the text and have it break onto multiple lines, much in the same way that UILabel does when we set numberOfLines = 0. In my mind, this should be possible by constraining the extent that the filter has to work within somehow, or by chaining it with a clamp (since the output bitmap is generated lazily.) Unfortunately, nothing I've run into seems to do the trick:
The CIClamp approach generates a nil outputImage when provided a CIVector(cgRect:) argument
There doesn't seem to be a way to specify a CIFilterShape to draw the text within when using the bundled filters
You can provide a CIFilterShape when invoking CIKernel.apply but a) I don't have a custom CIKernel (and am hoping not to write one) and b) I don't have a way to extract the kernel from the CIAttributedTextGenerator filter
I'm resigning myself to manually computing line breaks but it really seems like Core Image ought to be able to handle this use case. Am I just missing something?

How to change font and color of floating damage numbers? [World of Warcraft 1.13.3]

I would like to change the font of the floating text, as well as its color, depending on the school of magic which was damaged.
I can get the school of magic of the damage done in the event handler "COMBAT_LOG_EVENT_UNFILTERED" by filtering out events in which "sourceGUID" is my character and the result of the "GetSchoolString" function. But how to apply this to existing floating text?
I reviewed the add-ons "NameplateSCT" and "MikScrollingBattleText", but as I understand it they draw their own text, and do not use the floating text of the game. Can the code "https://github.com/Gethe/wow-ui-source/blob/classic/FrameXML/CombatFeedback.lua" help me? And if so, how?
Assuming this function isn't protected (to prevent cheating), you could just overwrite the function.
CombatFeedback_OnCombatEvent = function(self, event, flags, amount, type)
--copy paste the rest of the code here, and change it however you want
-- in the code, r, g and b are used to set the colour
end

Maxima for Android (and PC as well): How to reuse the result of a calculation

Let's say I enter this symbolic calculation in Maxima for Android:
integrate(sin(x)*x,x)
The answer is beautifully displayed thanks to MathJack (it is sin(x)-x*cos(x)). Ok, thanks. But now I would like to tap in that answer and have it in the command line, ready to be modified (for instance I may want to multiply it by some number and then use it in another calculation).
What I want is something similar to pressing the "ANS" key in some calculators, where the last result the machine yielded can be used as new input.
In Xcas Pad this is easy and straightforward (just touch on the result, that's all). How to do that in Maxima for Android? (The answer for the PC version of Maxima is also appreciated).
Remark: Copy-paste does not work in Android, because the answers are Latex-formatted or something similar.
You can tap the answer formula displayed with Mathjax in the main area. The maxima expression will be entered in the bottom command area, as you wanted.
Actually, the commands displayed in the main area are also tap-able. You can tap one of them and it is entered in the bottom command area.

Checking location of word range relative to the page

I am writing a vba macro that checks that word documents are formatted correctly to meet certain specifications. One of the things I have to check for are the left margins of each line - different paragraphs are supposed to have different first indents and hanging indents depending on the context. This should be as simple as checking the style, but unfortunately it is not - some of the documents use styles to change the indents, but others use manual spaces and tabs to position the text correctly. So I need some way to check the actual physical position of the first physical character in each Document.Paragraphs. I have no problem getting a range with the first visible character in the paragraph, but I'm not sure about getting the distance from the margin (or from the left side of the page - doesn't make a difference because the margins are consistent).
I found the Window.GetPoint method, but I'm nervous to use it, because that is based on the actual physical location on the screen. This macro is going to be used on different computers, with different versions of word, and I'm not sure about how it is affected by other view settings (like print layout, zoom, etc.) Is there a consistent way to use this method to determine the distance from the margin?
The other method would be (because all of the documents are in Courier New 12) to look at the firstindent property of the style, and the count manually all of the spaces and tabs (but that would need to take into account tabstops). This I'm also not sure how to do.
I would think that there should be a much simpler way of doing this, but I can't find it, so if anyone has any suggestions I would really appreciate any help.
It was there after all! Range.Information(wdHorizontalPositionRelativeToPage)

Random text in Corona

Totally new with Corona and asking for some support.
Would like to create a simple first software with Corona. My idea is to have a button and when you press the button you see different words on the screen. The idea is that they roll randomly and then stops on one word. For example 8 different words and one is chosen and a few seconds and shown on the screen.
For an expert I guess this is imple but for a rookie it´s not that easy.
Use a array of words to store the words
local words = {foo, bar, hi, no, yes, mom, dad}
Then use math.random to select a word.
local wordIwant = math.random(#words) -- # operador gets the length of a list
So if math.random returns 3 for example, wordIwant will be "hi"
:)
Now how you do your special effect and other pretty stuff, is up to you, but I recommend using the enterFrame listener for that.

Resources