Pages: 1 2 »
  Print  
Author Topic: Error - Invalid assignment to function  (Read 7534 times)
Offline (Unknown gender) The 11th plague of Egypt
Posted on: June 08, 2014, 08:03:30 am
Member
Joined: Dec 2009
Posts: 274

View Profile
I'm trying get an old .gm6 project of mine to run in ENIGMA.
http://sandbox.yoyogames.com/games/147289/download

It seems to import fine, but when I try to run it, I get this error
Code: [Select]
Building for mode (0)
Cleaning up from previous executions
 - Cleared parsed objects
 - Cleared room entries
 - Cleared shared locals list
 - Cleared event info
Loading shared locals from extensions list
Location in memory of structure: 519cd0d8
Copying resources:
Copying sprite names [5]
Copying sound names [0]
Copying background names [1]
Copying path names [0]
Copying script names [18]
Copying shader names [0]
Copying font names [1]
Copying timeline names [0]
Copying object names [9]
Copying room names [2]
SYNTAX CHECKING AND PRIMARY PARSING:
18 Scripts:
Parsed `load_map': 13 locals, 0 globals
Parsed `draw_a_button': 12 locals, 0 globals
Parsed `negative_color': 0 locals, 0 globals
Parsed `point_line_distance': 0 locals, 0 globals
Parsed `segm2segm_dist': 0 locals, 0 globals
Parsed `cells_under_line': 1 locals, 0 globals
Parsed `limit_steering': 0 locals, 0 globals
Parsed `lines_intersection': 0 locals, 0 globals
Parsed `lineVSwalls': 0 locals, 0 globals
Parsed `first_reachable_node': 2 locals, 0 globals
Parsed `cell_units': 0 locals, 0 globals
Parsed `optimized_BFS': 1 locals, 0 globals
Parsed `find_walls_to_avoid': 0 locals, 0 globals
Parsed `find_units_to_avoid': 0 locals, 0 globals
Parsed `collision_move': 0 locals, 0 globals
Parsed `rectangleVScircle': 0 locals, 0 globals
Parsed `save_map': 4 locals, 0 globals
Parsed `mouse_over_button': 5 locals, 0 globals
"Linking" scripts
`Linking' 18 scripts in 5 passes...
Completing script "Link"
Linking `load_map':
Linking `draw_a_button':
Linking `negative_color':
Linking `point_line_distance':
Linking `segm2segm_dist':
Linking `cells_under_line':
Linking `limit_steering':
Linking `lines_intersection':
Linking `lineVSwalls':
Linking `first_reachable_node':
Linking `cell_units':
Linking `optimized_BFS':
Linking `find_walls_to_avoid':
Linking `find_units_to_avoid':
Linking `collision_move':
Linking `rectangleVScircle':
Linking `save_map':
Linking `mouse_over_button':
Done.
"Linking" timelines
`Linking' 0 timelines in 0 passes...
Completing timeline "Link"
Done.
9 Objects:
 ob_vertex: 12 events:
  Event[0]:   Parsing 1 sub-events:
Check `ob_vertex::create... Done. Parse... Done.
  Event[1]:   Parsing 1 sub-events:
Check `ob_vertex::destroy... Done. Parse... Done.
  Event[8]:   Parsing 1 sub-events:
Check `ob_vertex::draw... Done. Parse... Done.
 ob_creator: 12 events:
  Event[0]:   Parsing 1 sub-events:
Check `ob_creator::create... Done. Parse... Done.
  Event[3]:   Parsing 1 sub-events:
Check `ob_creator::step...Syntax error in object `ob_creator', Step event:0:
Line 295, position 28 (absolute 10683): Invalid assignment to function `connect'

Here the piece of code, line 295 is connect=1
Code: [Select]
if (dist<=vertex_radius) //if there is a vertex under the mouse pointer
            {
                if vertex_b!=vertex_a //if B is not the same as A
                    connect=1
                else connect=0
            }

Any idea what the problem is?
This is old code that only uses the semicolon ; in var statements.
Logged
Offline (Male) Goombert
Reply #1 Posted on: June 08, 2014, 08:12:50 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Do you have a script named connect? What it's saying is there is a function somewhere called connect, so you can't use it as a variable name.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) The 11th plague of Egypt
Reply #2 Posted on: June 08, 2014, 08:45:16 am
Member
Joined: Dec 2009
Posts: 274

View Profile
Do you have a script named connect? What it's saying is there is a function somewhere called connect, so you can't use it as a variable name.
No, I don't.



Moreover, the var is declared in line 1.
Code: [Select]
var temp_map_name,vertex,vertex_a,vertex_b,create_vertex_a,node,node_a,node_b,create_node_a,dist,dist1,dist2,pos,connect;
Logged
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: June 08, 2014, 08:50:48 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
This is probably because we still aren't using exclusively namespace enigma_user for functions. If I had to guess, connect is some kind of sockets function someone unwittingly included in a header somewhere. The fewer includes we have from the engine, the better, so I'd prefer that be removed even if the ultimate solution is forcing functions to be read from enigma_user.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Goombert
Reply #4 Posted on: June 08, 2014, 09:16:43 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
I already considered that Josh and Berkeley Sockets does have a connect() function. However, Networking Systems are set to none by default, 11th please make sure under Build->Settings->"API" that Networking Systems is set to "None"
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) The 11th plague of Egypt
Reply #5 Posted on: June 09, 2014, 03:38:07 am
Member
Joined: Dec 2009
Posts: 274

View Profile
I already considered that Josh and Berkeley Sockets does have a connect() function. However, Networking Systems are set to none by default, 11th please make sure under Build->Settings->"API" that Networking Systems is set to "None"
Actually, it is.

Logged
Offline (Male) Josh @ Dreamland
Reply #6 Posted on: June 09, 2014, 06:33:15 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
It doesn't matter what declared "connect" as a function, the point is that something is. The user-side solution is to just name the variable something else. The ENIGMA-side solution is to only use functions from namespace enigma_user, but I'm not sure we're ready to make that jump.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Goombert
Reply #7 Posted on: June 09, 2014, 06:39:07 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
My only concern is Josh that it could be getting included incorrectly or scoped improperly, by which I am referring to the connect() function.

Anyway, oddly the function does not get syntax highlighted, so it is not in namespace enigma_user, and clearly not in namespace enigma or we wouldn't be having this issue. It could also be coming from OpenAL because it's dll is showing up when I regex for "connect" other than that only Berkeley Sockets shows.

Also I have tested and have reproduced this bug in an empty game with 1 object with the following code.
Code: (EDL) [Select]
var connect;

connect = 5;

And received the same function assignment error as the 11th plague.

Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) daz
Reply #8 Posted on: June 09, 2014, 06:50:16 pm
Contributor
Joined: Jul 2010
Posts: 167

View Profile
It doesn't matter what declared "connect" as a function, the point is that something is. The user-side solution is to just name the variable something else. The ENIGMA-side solution is to only use functions from namespace enigma_user, but I'm not sure we're ready to make that jump.
Why can't you just do it the GM way and create name prefixes? E.g. I have an object named "object", and the parser/compiler/whateveryoucallit prepends "obj_" to that object name. I feel like that would be easier than trying to put it all in a namespace.
Logged
Offline (Male) Josh @ Dreamland
Reply #9 Posted on: June 09, 2014, 09:48:41 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
We already do that, dazappa. This relates to naming a variable the same thing as a function. No one would be complaining if the variable behind the problem were called "instance_destroy" instead of "connect," but unfortunately, "connect" names a function as well.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #10 Posted on: June 10, 2014, 02:19:25 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
We already do that, dazappa. This relates to naming a variable the same thing as a function. No one would be complaining if the variable behind the problem were called "instance_destroy" instead of "connect," but unfortunately, "connect" names a function as well.
I think he mean "connect" needs to be changed into "obj_object_connect", so there would be no conflict. But we do it partially, but assigning function to variables should be possible, so resolving all these issues with changing the variables while parsing is not really the solution.
Logged
Offline (Unknown gender) Darkstar2
Reply #11 Posted on: June 10, 2014, 03:30:21 am
Member
Joined: Jan 2014
Posts: 1238

View Profile Email
use a prefix.

_connect works.

example  _connect = 1;
Works fine here.
Logged
Offline (Unknown gender) TheExDeus
Reply #12 Posted on: June 10, 2014, 01:18:21 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
That is just like saying to use a different variable name. The issue though, is that "connect" should probably be available. It's possible that someone has included some kind of a header in enigma_user namespace.
Logged
Offline (Unknown gender) Darkstar2
Reply #13 Posted on: June 10, 2014, 01:45:50 pm
Member
Joined: Jan 2014
Posts: 1238

View Profile Email
That is just like saying to use a different variable name. The issue though, is that "connect" should probably be available. It's possible that someone has included some kind of a header in enigma_user namespace.

Using _connect is much closer to the original variable than using a different variable.

BTW, could this be caused by BSnet.h / BSnet.cpp, example
 if (!server) { //client
  if (connect(s, sinf->ai_addr, sinf->ai_addrlen) == SOCKET_ERROR)


« Last Edit: June 10, 2014, 01:53:57 pm by Darkstar2 » Logged
Offline (Male) Goombert
Reply #14 Posted on: June 10, 2014, 02:39:05 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
No he has networking systems set to none, meaning the makefile is never even processed for that system, so no. I'm certain the conflict is coming from OpenAL.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1 2 »
  Print