Gamestudio Links
Zorro Links
Newest Posts
zorro license, IB connection
by miwok. 12/06/23 16:32
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (miwok, AndrewAMD, TipmyPip, 3run, Quad, 1 invisible), 645 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Syntex error, bit i dont see why #350234
12/14/10 18:50
12/14/10 18:50
Joined: Sep 2010
Posts: 82
P
peteredlin Offline OP
Junior Member
peteredlin  Offline OP
Junior Member
P

Joined: Sep 2010
Posts: 82
The following code gives an syntex error;
Code:
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

var Drijfstang_l = 1;
var Fdrijfstang;
var draaihoek;
var alfa;
var fliegwiel_r;
var gamma;
var Fzuiger = 10;
var Ffliegwiel;



SOUND* dieselhit = "singledieselhit.wav";
 
PANEL* panDisplay =
{
	digits(35, 10, "draaihoek = %0.f", *, 1, draaihoek);
	flags = VISIBLE;
}

function hoeksnelheid()
{
		if (draaihoek != 0 || draaihoek != 180)
		{
			alfa = asinv (Drijfstang_l / sinv( draaihoek * fliegwiel_r ));
		}
		else
		{
			alfa = 0;
		}
		gamma = 180 - alfa - draaihoek;
		Fdrijfstang = cosv(alfa) * Fzuiger;
		Ffliegwiel = sinv(gamma) * Fdrijfstang;
		
}


function main()
{
	hoeksnelheid();
	
}



I dont see why..


Last edited by peteredlin; 12/14/10 19:01.
Re: Syntex error, bit i dont see why [Re: peteredlin] #350235
12/14/10 18:53
12/14/10 18:53
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
In witch line? Don`t know if the VISIBLE flag is still supportet. Try the new SHOW flag instead.

Re: Syntex error, bit i dont see why [Re: Widi] #350237
12/14/10 19:02
12/14/10 19:02
Joined: Sep 2010
Posts: 82
P
peteredlin Offline OP
Junior Member
peteredlin  Offline OP
Junior Member
P

Joined: Sep 2010
Posts: 82
Well fixed the syntax error, but now it crashes in the hoeksnelheid function;

Error E1513

Re: Syntex error, bit i dont see why [Re: peteredlin] #350242
12/14/10 19:14
12/14/10 19:14
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Quote:
Code:
if (draaihoek != 0 || draaihoek != 180)

Is bad -- you're saying "If draaihoek is not zero, or draaihoek is not 180" -- since "draaihoek" can never be 0 and 180 at the same time, it'll always be true. I think what you mean is:
Code:
if (draaihoek != 0 && draaihoek != 180)

But even then, what if draaihoek is 360? or -180? And fliegwiel_r modifies the value anyway, so you still have a potential divide by zero. So really, it should be:
Code:
if (sinv( draaihoek * fliegwiel_r ) != 0)

Assuming the sole purpose of the if/else is to prevent a divide by zero.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Syntex error, bit i dont see why [Re: JibbSmart] #350244
12/14/10 19:42
12/14/10 19:42
Joined: Sep 2010
Posts: 82
P
peteredlin Offline OP
Junior Member
peteredlin  Offline OP
Junior Member
P

Joined: Sep 2010
Posts: 82
Thank you very much, that was what i needed.


Gamestudio download | chip programmers | 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