Missing argument for parameter 'OnChildWithName' in call when using SKAction - macos

hoping to get some quick help.
I am making an app that lives in the status bar on OS X and I'm trying to call a function every 5 seconds which prints "YEP" using the following SKAction.
let waitAction = SKAction.waitForDuration(5)
let checkIt = SKAction.runBlock {
println("YEP")
}
let action = SKAction.sequence([waitAction, checkIt])
SKAction.runAction(action) //error here
Could anyone please help me out with this error? It occurs at the line
SKAction.runAction(action)

There is no method called runAction on the SKAction class.
The method is runAction(_:onChildWithName:).
You must pass both the SKAction you wish to perform as well as the String which represents the name of the child you wish to run the action on.
SKAction.runAction(action onChildWithName: "NameOfChild")

Related

Why am I getting this error, when character is fully loaded?

I am trying to insert an animation into my code for the first time. Here is my code:
1 local player = game.Players.LocalPlayer
2 local char = player.Character or player.CharacterAdded:Wait()
3 local hum = char:WaitForChild("Humanoid")
4
5 local animaInstance = Instance.new("Animation")
6 animaInstance.AnimationId = "rbxassetid://4641537766"
7
8 local fireBallAnim = hum.LoadAnimation(animaInstance)
9 fireBallAnim:Play()
I am getting the error
The function LoadAnimation is not a member of Animation
I know the character has fully loaded, so I don't understand. Could I be getting this error if there is something wrong with the animation itself? What else am I missing out?
Thanks
local fireBallAnim = hum:LoadAnimation(animaInstance)
This is a very confusing message for the error. The only problem is that you've called a member function with a . as opposed to a :. Switching it to a colon will fix your error.
When you call a function on an object with a colon, it is automatically inserting the object as the first argument. A fun example of this can be seen with tables :
-- insert an object into the table 't'
local t = {}
table.insert(t, 1)
-- can also be written as...
t.insert(t, 1)
-- which is the same as...
t:insert(1)
All of these calls do the same thing. Calling the function with : is syntactic sugar for putting the t object as the first argument. So in your code, what's happening is you are calling LoadAnimation like this :
local fireBallAnim = hum.LoadAnimation(<a humanoid object needs to go here>, <animation>)
But since you are passing in the animation where the Humanoid is supposed to go, it is trying to find the LoadAnimation function on the animation object and failing.

PySide - How to connect a signal to a widget that was created through a method being called inside another method

I'm fairly new to programming so please be patient with me. I'm trying to create a simple script in Autodesk Maya. I've created a method that sets up two check-boxes side by side (See below)...
def checkboxLayout(self, name1, text1, name2, text2, parentLayout, initState):
##create and add horizontal layout
layout = QtGui.QHBoxLayout()
parentLayout.addLayout(layout)
width = 75
name1 = QtGui.QCheckBox(text1)
layout.addWidget(name1)
name1.setMinimumWidth(width)
name1.setMaximumWidth(width)
name1.setChecked(initState)
name2 = QtGui.QCheckBox(text2)
layout.addWidget(name2)
name2.setMinimumWidth(width)
name2.setMaximumWidth(width)
And later on I've called this method twice in order to save me having to write out the same big block of code twice...
def createLayout(self):
##Layout
mainLayout = QtGui.QVBoxLayout()
mainLayout.addWidget(self.title)
mainLayout.addSpacerItem(self.titleSpacer)
mainLayout.addWidget(self.oldLabel)
self.checkboxLayout("selection_CB", "Selection", "name_CB", "Name", mainLayout, True)
mainLayout.addWidget(self.textbox1)
mainLayout.addSpacerItem(self.midSpacer)
mainLayout.addWidget(self.newLabel)
mainLayout.addWidget(self.textbox2)
self.checkboxLayout("delHistory_CB", "Delete\nHistory", "freezeTrans_CB", "Freeze\nTransforms", mainLayout, False)
self.buttonLayout = QtGui.QGridLayout()
mainLayout.addLayout(self.buttonLayout)
self.buttonLayout.addWidget(self.cancelButton, 0, 0)
self.buttonLayout.addWidget(self.okButton, 0, 1)
self.setLayout(mainLayout)
My problem is that when I try to connect a signal to it, it won't work. All the tutorials I've watched so far have only connected signals to widgets that WERE NOT created by calling a method inside another method (I realize that probably isn't the correct terminology but like I said, I'm new to this :( ) I'll post the code that I've written to try and connect the signal below. My guess was that I had to specify the method that created the check box, but I couldn't get that to work either. So how do I get this signal connected? Also feel free to correct my terminology :) Thanks to anyone who can help :)
def createConnections(self):
self.selection_CB.toggled.connect(self.checkboxLine1_ChangeState)
Where and how are you setting the variable self.selection_CB?
In your checkboxLayout function you can include a return for your check box like so:
`return [name1, name2]`
then simply assign them as you're calling the function and connect the events from there:
self.check1, self.check2 = self.checkboxLayout("selection_CB", "Selection", "name_CB", "Name", mainLayout, True)
Or if they are always being connected to the same functions, then why not just do the connection straight from checkboxLayout?
name1.stateChanged.connect(self.checkboxLine1_ChangeState)

Need assistance with unfamiliar syntax, error - e is undefined - Google Apps Script(GAS)

I'm using a script exactly like the one on the tutorial here, https://developers.google.com/apps-script/reference/ui/file-upload
However, despite using the syntax I keep getting e is undefined in the statement:
var fileBlob = e.parameter.dsrFile;
I think that means my function doPost(e) is probably wrong somehow. Here is my entire script below.
// Create Menu to Locate .CSV
function doGet(e) {
var app = UiApp.createApplication().setTitle("Upload CSV");
var formContent = app.createVerticalPanel();
formContent.add(app.createFileUpload().setName("dsrFile"));
formContent.add(app.createSubmitButton("Start Upload"));
var form = app.createFormPanel();
form.add(formContent);
app.add(form);
return app;
}
// Upload .CSV file
function doPost(e)
{
// data returned is a blob for FileUpload widget
var fileBlob = e.parameter.dsrFile;
var doc = DocsList.createFile(fileBlob);
}
e is undefined because you are not passing anything to doPost. You have to pass the needed object to doPost. Check where you call the function and what parameters do you pass to it if any. Even if you pass a parameter to that function, it holds undefined value. Make sure that you are passing the correct objects to your functions.
Your script should work perfectly. e is defined by Google Apps Script, not need to pass anything in particular is contains the fields of your form, in particular in this case the file you uploaded.
I would suspect you may be falling foul to the dev url vs publish url syndrome, where you are executing an old scrip rather that the code you are currently working on.
Be sure you script end with 'dev' and not 'exec'
https://script.google.com/a/macros/appsscripttesting.com/s/AKfyck...EY7qzA7m6hFCnyKqg/dev
Let me know if you are still getting the error after running it from the /dev url

Are breakpoints not working as they should in DartEditor?

I'm getting some unexpected behaviour in the most recent Dart editor (version 0.4.0_r18915).
I have this minimal command line app that was intended to either take a command line argument or not and print a hello -somenoe- message. The application works just fine. But the debuggins fails to stop at the breakpoints set inside each of the if statement bodies. (I wanted to look at the state of the application weather the options.arguments.isEmpty was true or false)
var person;
main(){
var options = new Options();
if(options.arguments.isEmpty){
person = "someone who forgot to pass a command-line argument";
} else {
person = options.arguments[0];
}
print("Hello, $person!");
}
Debugger will stop at breakpoints in other lines but not in:
person = "someone who forgot to pass a command-line argument";
or in:
person = options.arguments[0];
Yes, file a bug. My suspicion is that the debugger can only stop at what's called a "safepoint" and that the assignment of a constant to a variable doesn't create one. Adding some line above it, like
print("breakpoint");
should help if that's the case. But I've also seen other problems with breakpoints not firing.

How to pass special parameters in a function in Ruby Selenium Webdriver

I'm using Selenium Webdriver Ruby to create a function in order to wait for an element displayed within a Time that I set in this function
My function will have two parameters (one Optional parameter & one parameter is locator name of an object)
So, I have my function with two parameters like below:
def wait_for_element_displayed(locator, options={})
if options[:time]
settime = options[:time]
else
settime= 60
end
#driver.find_element(locator).click
end
So, I will call this function like: wait_for_element_displayed(:id=>"unique1", :time => "20")
However, I got the error when trying to calling this function with this way, the error is: "TypeError: can't convert String into an exact number".
Anybody please help me how to pass two parameters like my scenario to a function? Any help appreciated.
A few suggestions:
You can use hash#fetch to set a default value if the key you are looking up is not present:
time = options.fetch(:time) { 60 }
Ruby will have a hard time parsing your input when both arguments are hashes and you don't differentiate between them. Also, your error makes me think you should provide 20 as an integer instead of a string. Try calling the method like this:
wait_for_element_displayed({:id => "unique1"}, { :time => 20 })
Lastly, I don't know much about Selenium, so maybe someone can fill me in on the last point. Is setting a settime variable sufficient to configure timeouts?

Resources