Gamestudio Links
Zorro Links
Newest Posts
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
Zorro version 3.0 prerelease!
by TipmyPip. 02/24/26 17:09
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (Martin_HH, TipmyPip, AndrewAMD, Grant), 5,825 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Syntax error:Can't convert CONV:FIXED #284224
08/12/09 09:32
08/12/09 09:32
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Hello All,

I hope somebody has an idea to explain me what's the reason behind the error I got.. Here is my code snippet:

Assumes that my handle_error function is already implemented as well..

Code:
typedef struct {
   signed char  steering;   
} my_struct;

my_struct data;

void get_brake_data()
	{
		while(1)	
		{
			handle_error(get_brakedata( &data ));
			wait(1);
		}
	}


function get_steering()
{
  return data.steering;
}




But I just got "Syntax error:Can't convert CONV:FIXED::.
< return steering;
>
" error.. why?


get_brakedata function is from my plug-in dll which has a prototype of
Quote:

get_brakedata( MyData* data )


It'll be successful if I'll just let a variable receive the value from the function like the code below. I can receive the exact value that I want but I just need to implement a getter function to minimize errors, since I'll be sending this value to other game applications. I just want them to use get_steering() function to retrieve the value and not by just calling a single variable "steering_value" coz they can be able to assign a value on it..

Code:
var steering_value;
void get_brake_data()
{

	while(1)	
	{
		handle_error(get_brakedata( &data ));
                steering_value = data.steering
		wait(1);
	}
}




Please advise..



Can't is not an option™
Re: Syntax error:Can't convert CONV:FIXED [Re: seecah] #284226
08/12/09 09:57
08/12/09 09:57
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
Hello!

Obviously in some situations a char can't be casted to a var properly.

This could help as a simple workaround:
Code:
function get_steering()
{
  return data.steering - 0;
}



Re: Syntax error:Can't convert CONV:FIXED [Re: Saturnus] #284229
08/12/09 10:08
08/12/09 10:08
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Can you please explain further why we should subtract it by 0? :-)



Can't is not an option™
Re: Syntax error:Can't convert CONV:FIXED [Re: seecah] #284234
08/12/09 10:26
08/12/09 10:26
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
The expression "data.steering - 0" should evaluate to an integer (as only integers are involved). Integers can be converted to vars without any problems. : )

I don't know why the conversion from char to var doesn't work sometimes, though.

Re: Syntax error:Can't convert CONV:FIXED [Re: seecah] #284242
08/12/09 11:06
08/12/09 11:06
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Originally Posted By: seecah
I just want them to use get_steering() function to retrieve the value and not by just calling a single variable "steering_value" coz they can be able to assign a value on it..


How about using a constant, so they can't assign to the variable, but only read it.

Re: Syntax error:Can't convert CONV:FIXED [Re: DJBMASTER] #284254
08/12/09 11:38
08/12/09 11:38
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Yeah I know that but I it's really different to have a getter function for other applications to use rather than constant.. I'll not prefer using constant...



Can't is not an option™

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1