Game would not run in game maker and it said "cannot use function/script name for a variable,using"motion_add" - gml

this was happening to me as I tried to make an astroids game on game maker. I put in the code motion_add[image_angle, 0.2] and it was working fine then it said
"cannot use function/script name for a variable,using"motion_add"
if you guys could help me I would be grateful thank you.

You are using the motion_add() function. The syntax should be
motion_add(image_angle, 0.2);
when you use the " [ ] " symbols for the arguments, as you did, you are telling Game Maker to look for the data in the "motion_add" array at the coordinates "image_angle" and "0.2". That is not what you want. Also, do not forget the ";" at the end of your line.

Related

Object name contains more than the maximum prefixes allowed

I have seen a lot of questions about this but I couldn't find the correct answer for me which works.
The object which triggers the problem is like
test123.de.company.com.Database.dbo.Table
Test123.de.company.com
is the database Server.
Object name contains more than the maximum prefixes allowed
I have tried to write it like this [test123.de.company.com].Database.dbo.Table just like [test123.de.company.com].[Database].[dbo].[Table]
Can you tell me what's wrong with this?
Please try this:
["test123.de.company.com"].[Database].[dbo].[Table]
OP also encountered a new problem after implementing this solution above. OP said:
Thank you! This worked for me. To be more precise, the join is for a
view and if I save/close and then later get back to the design option
the quote marks are removed and there is [test123.de.company.com] left
over and the error returns. Is there a way to keep them fixed?
Otherwise if I change anything I always have to add the quote marks
again and again
Then with the help of DaleK that problem also was solved. DaleK:
Don't use the design option, script it as alter instead

How to validate operators in a simple calculator vb program?

So I've been trying to do a calculator program in Visual Basic (shouldn't be too bad, I think). So far I got everything down and tested the operators individually. What I'm trying to do is to have the equals sign be able to determine which operator to use and go with it according to the button pressed for operator. I thought maybe if/else or switch/case could work, but I'm either getting addition first (it's the first in the choices) or nothing at all
Maybe I'm validating the wrong variable perhaps. I thought maybe that as an example:
if btnEquals.Text = "(insert operator sign here)" Then
{insert operator statement here}
on an if/else or case would do it, but it's simply not. I have checked in SO for any similar issue in VB, but most are for another language. I know I have to do something to ensure that the buttons coincide with the logical statements
Basically: How do I make the "=" button in the calculator program do the right arithmetic operation when the "+", "-", "/", "*" buttons are pressed? I tried if/else and case/switch and it's not logically giving the right answers.
Edited to clarify for other users.
Thanks in advance!
Already found an easy way to do it and it worked, it was simpler than I thought and was pulling my hair for no reason. Just for future reference. I just added a type char variable and with each arithmetic button (+,-,*,/) assign the arithmetic symbols to the variable and then use if/else or case switch in the "=" button to validate that variable.
Anyone with higher rank, you can go ahead and close this one. Thank you!

To detect even number using LabVIEW

I was trying to make the even calculator without using code in LabVIEW but the problem was when i ran the code i get 0 between all the even numbers between 1-100.
I just want the even no in array not 0s.
What modification should i make for it.
Vivien's answer will not going to help you.
You are in right way. Just right click on the output terminal and select Conditional terminal. Remove case structure and connect your boolean line directly to the conditional terminal.
Please read here: https://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/condacc_valuesnloops/
PS. to get evens between 1-100 you should add 1 to iteration terminal (or you will have event between 0-99).
You can do something like this :

Saving Structure leads to error "Index exceeds matrix dimensions."

I have two different structures (DATA and orient). They both are build up like this: DATA.S(1).M(1).A(1).var1 etc...
When I want to save them with the following lines:
text='data1';
filename=strcat('save/',text,'.mat');
save(filename, 'DATA', 'orient');
I get the error "Index exceeds matrix dimensions." for the save line.
When I stop the Programm before the line and try to save it manually over the Workspace matlab is crashing but using all the processing power.
I'm using MAtlab R2014a an the structs are between 2000-4000Bytes.
I hope anyone has a idea what it could be about. Thanks for your help!
Ok, I found a solution. I simply used the following code(http://www.mathworks.com/matlabcentral/fileexchange/39721-save-mat-files-more-quickly/content/savefast.m) from Tim Holy. Now it works without any problems. Thanks Tim Holy!!! :)

How to use _root and this[] in same line?

Here's a chunk of code that WORKS when it's on the main timeline:
var DysonTarget:String = "S"+(random(40)+1);
this[DysonTarget].MyType = "Dyson Sphere";
this[DysonTarget].gotoAndStop(this[DysonTarget].MyType);
It's choosing a number between 1 and 40, adding an S before it, and going into one of forty movie clips on the main stage with instance name S1, S2. . . S40 etc. Then it will display an image in the chosen clip. But to make this truly work the way I want to, I have to put the above code inside a movie clip. So I tried this, after declaring my variable on the main stage:
_root.this[DysonTarget].MyType = "Dyson Sphere";
_root.this[DysonTarget].gotoAndStop(this[DysonTarget].MyType);
It didn't compile, the error message said "Expected a field name after the '.' operator. Trying it with _parent returned the same message. With _level0 didn't work at all, and placing the _root and _parent inside the bracket didn't work either. I haven't been able to find any answer online because trying to type "this" into a search is too vague to return an answer about the actual command.
. . .help me :(
A friend of mine who is a software developer helped me on this one. Here's what we figured out:
First you declare variable DysonTarget on the main timeline:
var DysonTarget:String = "S" + (random(40)+1);
Then inside the movie clip, use this:
_level0[DysonTarget].MyType = "Dyson Sphere';
_level0[_level0.DysonTarget].gotoAndStop(_level0[_level0.DysonTarget].MyType);
I've tried this a few other ways, and the above method is the only one that works the way it's supposed to. But it works! My impression is the brackets tell it to look for an object named what the variable is set to, rather than an object with the same name as the variable.