How to Make Something Happen at a certain point in a Roblox Animation - lua

I'musing Roblox Studio and can't figure out how to make it print 'test' at a certain point in the animation. Here is the code:
animationTrackTwo:GetKeyframeReachedSignal("Throw"):Connect(function(value)
print("test")
end)
local animationTrackTwo = character.Humanoid:LoadAnimation(script.Parent.ThrowSnowball)
animationTrackTwo:Play()
I think i inserted a keyframe into the animation called 'Throw" (I may have done it wrong) but it says GetKeyframeReachedSignal is not a valid member of animationTrack. Anyone know what I'm doing wrong?

Try using the :GetMarkerReachedSignal() function, More information can be found at: https://developer.roblox.com/en-us/api-reference/function/AnimationTrack/GetMarkerReachedSignal

Related

Pinescript code give "no data" on tradingview or gives cant find a certain function error

this is quite new to me, so I've been trying to make it work for the past few days, but keep getting errors.
I'm trying to create a strategy code for several indicator, but get "Could not find function or function reference 'sma'" error or it compiles perfectly but get no data on the overview pane...
I decided to try the most basic code to see what happens:
strategy("Simple Moving Average Strategy", overlay=true)
// Define the moving average
ma = sma(close, 20)
// Buy signal
strategy.entry("Buy", strategy.long, when=crossover(close, ma))
// Sell signal
strategy.exit("Sell", when=crossunder(close, ma))
This yields no data.
can someone please assist?
also, if you guys can explain why I get "Could not find function or function reference 'sma'" (or other functions) eventhough the rest of the code is just fine, that would be great.
Thanks!
Tried reducing the code to its basics, to pinpoint the error.

WoW Addon Help - Unit Reaction of MouseOver

I last created Mods back before Cataclysm. It's been a long time. Just now getting back into it. I'm just trying to write a very basic mod that cancels attacking with the right mouse button.
WorldFrame:HookScript("OnMouseUp", function(self, button)
if button == "RightButton" then
local mouseoverName = UnitName("mouseover") or "Unknown";
local reaction = UnitReaction("mouseover", "player") or 10;
if reaction < 5 then
DEFAULT_CHAT_FRAME:AddMessage("Stopped Attack on: "..mouseoverName);
MouselookStop();
else
DEFAULT_CHAT_FRAME:AddMessage(mouseoverName.." is friendly! "..reaction);
end
end
end)
The code I have should be working (from what I can tell) - but it's not. The code always returns Unknown & 10. If I swap out mouseover for player it works fine (but doesn't actually give me the data I need).
Also, if I swap out and hook-into OnMouseDown it also works, but then I can't actually interrupt the attack.
Any insight on why it's not working or how to fix it would be appreciated... Also if there is just a better way to do things I'm all ears.
UnitName("mouseover") indeed returns nil while any mouse button is pressed.
This is quite a smart idea to prevent attacking hostile units with mouse click. It probably doesn't work because Blizard really made sure to protect any possible thing to do with the WorldFrame that could be abused.
https://wow.gamepedia.com/API_GetCursorInfo sadly also doesn't return if the cursor is currently the sword icon, only if it's holding something.

For an SKSprite, is customAction actually the Update call?

Because of general psychosis, Apple put an update() call in SKScene, but they forgot to put an Update call in SKSpriteNode.
Now, as far as all our testing can determine,
In SpriteKit, just using a "customAction" on a sprite seems to be exactly the same as running something in update in the scene.
func teste() {
let a = SKAction.customAction(withDuration: 5.0) { [weak self] node, elapsedTime in
print("Honest to goodness, this is the run loop. I think.")
print("\(self?.k) \(elapsedTime)")
self?.k += 1
}
run(a)
}
I have scoured the documentation to no avail.
Does anyone know if it's really true that "customAction" indeed runs every frame? Is it effectively and safely an Update call?
(Example: conceivably, there could be a horrific coincidence that they run it "every 1/60th" or something, and it's not really running on the same runloop as the scene.)
Or, since apparently it's really just Box2D, maybe someone can shed light on this from the Box2D milieu?
Resolution of the issue:
Thanks to Knight, we now know that using customAction "as the Update call" is almost the same as in the update call: it happens in the second phase of the run loop, which is immediately after the update phase.
{If you prefer to have it actually happen in the update phase, you would need to use the usual workaround in SpriteKit - just call your own update function in the game objects, from, the Update call apple provide in the scene.}
All action happen in the action phase of the update cycle
See https://developer.apple.com/documentation/spritekit/skscene

ActionSricpt 3 - Move to the certain scene

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at CompangleComplete_fla::MainTimeline/loop()[CompangleComplete_fla.MainTimeline::frame119:205]
I got this error.
When the player touch the "black rectangle", supposed to move to the next scene.
I try to check where is the problem, then I try this
if(endpoint==false){
if(player.hitTestObject(back.other)){
endpoint==true;
trace("next scene");}
the code run without error.
But then I try this,
if(endpoint==false){
if(player.hitTestObject(back.other)){
endpoint==true;
gotoAndPlay(2, "Scene 9");}
I got error like above.
The code for my gotoAndPlay(2, "Scene 9") is wrong. How I should change it?
There appears to be a method loop() being executed repeatedly. My guess is that Scene 9 does not contain one of the objects referenced in that loop. You can pinpoint the specific line of code by debugging the movie within Flash (ctrl + shift + enter).
Without more code it is hard to determine exactly what you are doing, but if you must change scenes I recommend stopping any loops/ENTER_FRAME listeners first, then starting them again in the new scene.

Rubymotion - Ending Dispatch::Queue

I'm new to the whole iOS development both objective-c and rubymotion. So this may be a dumb question.
I'm trying to read a barcode from the camera and I can get it to read using AVCaptureMetadataOutput
So I have the following code:
#queue = Dispatch::Queue.new('com.scanner.app')
#output = AVCaptureMetadataOutput.alloc.init
#output.setMetadataObjectsDelegate self, queue: #queue.dispatch_object
Then the following method gets called.
def captureOutput(captureOutput, didOutputMetadataObjects: metadataObjects, fromConnection: connection)
#queue.async do
NSLog("#{metadataObjects[0].stringValue}")
end
Once I receive the barcode how could I exit this queue and continue execution of the program? I know this is some advanced stuff I've literally only been using this 2 days need to mock something together quick time.
I'm not even sure if this is the correct way about reading a barcode from the camera.
This controller is triggered when a user taps a button navigation controller loads it up with the following.
self.navigationController.pushViewController(ScannerController.alloc.init, animated: true)
So would I be able to return back once I have found a barcode? If someone could point me in th e right direction it'd be greatly appreciated.
Thank you in advance!!
Managed to solve it will the following code:
Dispatch::Queue.main.async do
if metadataObjects.any?
self.barcode = metadataObjects[0].stringValue
#queue.suspend!
process_barcode
end
true
end
Might not be the best way but works.

Resources