Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
syntax error #307259
01/28/10 09:14
01/28/10 09:14
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
using search in gamestudio manual looking under the word "force" I am looking at the myCrate example bottom below:
However when running even just the line
var gravity[3] = 0,0, -386;

I always get a syntax error
why is this?
Perhaps someone out their can clear this up. Do I need something else at the very top to make this syntex usable?
is this example of force workable by itself.
thanks


/////example////
#include <acknex.h>
#include <default.c>
#include <atypes.h>

entity* myCrate;
var gravity[3] = 0,0, -386;
var crateMass= 10;
phent_settype( myCrate, PH_RIGID, PH_BOX );
phent_setmass( crateMass );
// force is three times as strong as gravity's pull, so we can lift up the entity, while pressing a key
while (key_pressed( key_for_str("L")) )
{
vec_set( temp, gravity );
vec_scale( temp, -3 * crateMass );
phent_addforceglobal( myCrate, nullvector, temp );
wait(1);
}

Re: syntax error [Re: ncc1701d] #307290
01/28/10 12:45
01/28/10 12:45
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
You can set the gravity using ph_setgravity(vector(0,0,-386));

Re: syntax error [Re: Razoron] #307356
01/28/10 18:29
01/28/10 18:29
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
I know the gravity can be set the other way but for this crate example which I am trying to get working and learn and understand from sets gravity as a variable probably for a special reason?
Maybe someone knows how to do this same crate example just written a differnt way?
thanks

Re: syntax error [Re: ncc1701d] #307361
01/28/10 18:55
01/28/10 18:55
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
you have to write entity in big. i mean this:
ENTITY* myCrate;


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: syntax error [Re: alibaba] #307362
01/28/10 18:57
01/28/10 18:57
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
hmmm.. you´re right. the var gravity[3] = 0,0, -386; isnt working.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: syntax error [Re: alibaba] #307369
01/28/10 19:26
01/28/10 19:26
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
var xyz[3] creates under c-script a vector. As you are using Lite-C, you must change this to VECTOR xyz = {...};


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: syntax error [Re: WretchedSid] #307375
01/28/10 20:25
01/28/10 20:25
Joined: Sep 2009
Posts: 496
P
Progger Offline
Senior Member
Progger  Offline
Senior Member
P

Joined: Sep 2009
Posts: 496
try this
VECTOR* vec_gravity = {x = 0; y = 0; z = -3600;}
WFG programmer smile


asking is the best Way to get help laugh laugh laugh

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