Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,227 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
wath is wrong with this code #325997
05/29/10 16:48
05/29/10 16:48
Joined: May 2010
Posts: 63
J
JohnnyIsDutch Offline OP
Junior Member
JohnnyIsDutch  Offline OP
Junior Member
J

Joined: May 2010
Posts: 63
what is wrong with this code
Code:
action player_move
{
player = me;
wait(1);
while (me != NULL)
{
move_vec[0] = (key_cuu - key_cud)*3 *time;
move_vec[1] = (key_comma - key_period) *2 *time;
player.pan += (key_cul-key_cur)*4 *time;
ent_move(move_vec,NULLVECTOR);
If (move_vec[0] == 0 && move_vec[1] == 0)
{
idle_percent = (idle_percent +5*time)%100;
ent_animate(me,"idle",idle_percent,ANM_CYCLE);
}
else
{
// our movement animations will go here
walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100;
ent_animate(player,"walk",walk_percent,ANM_CYCLE);
}
wait(1);
}
}

error in main
syntax error

Last edited by JohnnyIsDutch; 05/29/10 16:51.
Re: wath is wrong with this code [Re: JohnnyIsDutch] #326005
05/29/10 17:23
05/29/10 17:23
Joined: Mar 2010
Posts: 57
Germany, Niedersachsen
LemmyTheSlayer Offline
Junior Member
LemmyTheSlayer  Offline
Junior Member

Joined: Mar 2010
Posts: 57
Germany, Niedersachsen
i think you should use
if ((move_vec[0] == 0) && (move_vec[1] == 0))
instead of
If (move_vec[0] == 0 && move_vec[1] == 0)


SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE
Re: wath is wrong with this code [Re: LemmyTheSlayer] #326072
05/30/10 07:40
05/30/10 07:40
Joined: Apr 2010
Posts: 56
Badrizmo Offline
Junior Member
Badrizmo  Offline
Junior Member

Joined: Apr 2010
Posts: 56
@LemmyTheSlayer: Parenthesis in this case is useless as the && operator precedence is lower than the == so the code will be be the same with or without the parenthesis. check this page http://www.difranco.net/cop2220/op-prec.htm

@JohnnyIsDutch: I think you should add () at the end of your action name, as far as I remember it is required in lite-c. Give it a try and let me know the results. Also if you can write the exact error message you got.

For now replace
action player_move

With
action player_move()

If you have time you may check lesson 10 in the Lite-c workshops, here is the link
http://tutorial.3dgamestudio.net/

Re: wath is wrong with this code [Re: Badrizmo] #326073
05/30/10 08:05
05/30/10 08:05
Joined: May 2010
Posts: 63
J
JohnnyIsDutch Offline OP
Junior Member
JohnnyIsDutch  Offline OP
Junior Member
J

Joined: May 2010
Posts: 63
Originally Posted By: Badrizmo
@LemmyTheSlayer: Parenthesis in this case is useless as the && operator precedence is lower than the == so the code will be be the same with or without the parenthesis. check this page http://www.difranco.net/cop2220/op-prec.htm

@JohnnyIsDutch: I think you should add () at the end of your action name, as far as I remember it is required in lite-c. Give it a try and let me know the results. Also if you can write the exact error message you got.

For now replace
action player_move

With
action player_move()

If you have time you may check lesson 10 in the Lite-c workshops, here is the link
http://tutorial.3dgamestudio.net/


i have a simple code with the same error "error in main"
but () isn't work, here is the error


and the code:


Code:
// noname.c

function main()
{
  level_load("noname.wmb");		// load level newlevel.wmb
}

action player
{
	player = me;
}



Last edited by JohnnyIsDutch; 05/30/10 08:06.
Re: wath is wrong with this code [Re: JohnnyIsDutch] #326075
05/30/10 09:24
05/30/10 09:24
Joined: Apr 2010
Posts: 265
V
Vinous_Beret Offline
Member
Vinous_Beret  Offline
Member
V

Joined: Apr 2010
Posts: 265
you'r problem is in 'default.c' i guess, did you modified the file?
plus you should put () after action's name:

action move_player()

Re: wath is wrong with this code [Re: Vinous_Beret] #326076
05/30/10 09:30
05/30/10 09:30
Joined: Mar 2010
Posts: 57
Germany, Niedersachsen
LemmyTheSlayer Offline
Junior Member
LemmyTheSlayer  Offline
Junior Member

Joined: Mar 2010
Posts: 57
Germany, Niedersachsen
my default.c looks the same but i have no problems.
i suggest to reinstall gamestudio


SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE
Re: wath is wrong with this code [Re: LemmyTheSlayer] #326077
05/30/10 09:33
05/30/10 09:33
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
you can't do

NULL!=player

you should

player!=NULL


3333333333
Re: wath is wrong with this code [Re: Quad] #326080
05/30/10 09:54
05/30/10 09:54
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
NULL!=player is correct, this is not the problem. The problem is wrong syntax, forgetting the () and naming his action "player", this gives a syntax error when ever "player" is used in the script.



Re: wath is wrong with this code [Re: Quad] #326081
05/30/10 09:55
05/30/10 09:55
Joined: May 2010
Posts: 8
A
Alex8888 Offline
Newbie
Alex8888  Offline
Newbie
A

Joined: May 2010
Posts: 8
There is no wait(1) after the level load. This is always required.

Re: wath is wrong with this code [Re: Alex8888] #326082
05/30/10 09:56
05/30/10 09:56
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
That is nonsense.

Wildly putting "wait(1)" in the code or reinstalling Gamestudio will not fix a mistake. You should not give beginners such suggestions when you don't understand the problem. Its not helpful.

Page 1 of 2 1 2

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