Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (M_D, AndrewAMD, Quad, Ayumi), 806 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
c_move question #151679
09/02/07 14:06
09/02/07 14:06
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
Code:
temp = vector(1,0,0);
wait(-5.0);
c_move(me, temp, nullvector, GLIDE);


I'm using the above code and my model teleports after the 5sec delay. I've tried changing the x value to 0.1 and the result is still the same. My intention was for the model to just walk/run...what am I doing wrong?

Re: c_move question [Re: Torr] #151680
09/02/07 15:44
09/02/07 15:44
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
hello

he is moving 1 qaunt a fram say you have 120 fps he is moving 120 qaunts *
wait(-5);

c_move(me, temp, nullvector, GLIDE)*time_step;

ore

temp = (key_cuu - key_cud)*time;


"empty"
Re: c_move question [Re: Torr] #151681
09/02/07 17:13
09/02/07 17:13
Joined: Nov 2002
Posts: 792
Berne, Switzerland
elsewood Offline
User
elsewood  Offline
User

Joined: Nov 2002
Posts: 792
Berne, Switzerland
write it like that: Code:
 
wait(-5.0);
temp = vector(1,0,0);
c_move(me, temp, nullvector, GLIDE);

The problem with your code ist that temp will sure be used by other functions during the wait instruction... So better use a local variable for that!!


A bus station is where the bus stops. A train station is where the train stops.
On my desk I have a workstation...
Re: c_move question [Re: elsewood] #151682
09/03/07 09:51
09/03/07 09:51
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
The code still doesn't work. You're right about temp being modified but I have no idea by what since I don't use it anywhere else. I added a watch(never thought of that before) on temp, set a breakpoint at temp = vector(1,0,0); and the x value goes from 0 to 264628.23 at that point. Is temp a predefined variable? I've tried changing it to another name and I get an Unknown Parameter error.
Code:
// main game loop
while(1)
{
if(gid01_level_state != gid01_level_loaded)
{
freeze_mode = 1; // pause the game
while(gid01_level_state != gid01_level_loaded) { wait(1); }
freeze_mode = 0; // resume the game
}

wait(1);

UpdateBots();
}


Function is defined in another wdl.
Code:
function UpdateBots()
{
my = ptr_for_handle(list[0]);
wait(-5.0);
temp = vector(1,0,0);
c_move(me, temp, nullvector, GLIDE);
}



Re: c_move question [Re: Torr] #151683
09/03/07 11:04
09/03/07 11:04
Joined: May 2003
Posts: 567
Spain, Canary Islands
Felixsg Offline
User
Felixsg  Offline
User

Joined: May 2003
Posts: 567
Spain, Canary Islands
You like to teleport not to move?

then why not assing the cordinates directly to the model

my.x=???? my.y=???? and my.z ????

if you like to move to a detirminate posotion you can put a invisible object (teleporter place) and take the corrdinates form there I not renember the syntax but gamestudio have a lot of great fuctions

C_move is for move not for translate it I not wrong

Re: c_move question [Re: Torr] #151684
09/03/07 11:05
09/03/07 11:05
Joined: Jul 2000
Posts: 8,973
Bay Area
Doug Offline
Senior Expert
Doug  Offline
Senior Expert

Joined: Jul 2000
Posts: 8,973
Bay Area
Quote:

Is temp a predefined variable?



Yes.

Quote:

I've tried changing it to another name and I get an Unknown Parameter error.



In Lite-C (or C-Script) you need to define a parameter before using it. Parameters like "temp" and "my" are already defined, so you don't get an error.

See the user manual for more information (Lite-C->Syntax->Variables).


Conitec's Free Resources:
User Magazine || Docs and Tutorials || WIKI
Re: c_move question [Re: Doug] #151685
09/03/07 12:37
09/03/07 12:37
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline
Serious User
Nowherebrain  Offline
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
ok...now
you ignored the fact that you must use

* time_step / 16;
...you should use that, and just use a number, instead of refering to a variable to make sure it works. If it does, define a variable(inside the top of the action/function) to keep it local, if it is global, you will end up with bots that are adding to their speed or other weird things.


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
Re: c_move question [Re: Felixsg] #151686
09/03/07 13:38
09/03/07 13:38
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
Thanks for the replies, everyone. I'm really new to this so I appreciate all the help I'm getting
Quote:

You like to teleport not to move?



No, I want to move, not teleport/translate.
Quote:

In Lite-C (or C-Script) you need to define a parameter before using it. Parameters like "temp" and "my" are already defined, so you don't get an error.



I've tried these(C-Script):
Code:
var temp_vec;
//entity* temp_vec;
temp_vec = vector(1,0,0);


entity* temp_vec doesn't compile. I thought vector() returns a pointer?
var works. Does temp_vec become an array in this case?
Quote:

ok...now
you ignored the fact that you must use

* time_step / 16;
...you should use that, and just use a number, instead of refering to a variable to make sure it works. If it does, define a variable(inside the top of the action/function) to keep it local, if it is global, you will end up with bots that are adding to their speed or other weird things.



Do you mean flits's code?
Code:
wait(-5);

c_move(me, temp, nullvector, GLIDE)*time_step;

ore

temp = (key_cuu - key_cud)*time;


I didn't understand why there's *time_step or the 2nd line so I tried elsewood's suggestions first. Can you explain further?

Re: c_move question [Re: Torr] #151687
09/03/07 14:54
09/03/07 14:54
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline
Serious User
Nowherebrain  Offline
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
it should be something like this....

c_move(me,(vector((10 * time_step / 8),0,0)),nullvector,glide);
not all the brackets are necessary, but it's good practice to encapsulate or separate math operations.

there you would be moving forward(the actors "X")

a vec is using vector(x,y,z), you could add gravity by adjusting the "Z" paramater.
alternately it could be used to define color...
vector(red,green,blue), it really depends on the variable. I hope this makes sense and that it helps.


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
Re: c_move question [Re: Nowherebrain] #151688
09/03/07 14:58
09/03/07 14:58
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline
Serious User
Nowherebrain  Offline
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
a global variable is outside a function or action where all other functions and actions can see or modify it....
////global////
var test;
function junk()
{

}

////local////
function junk()
{
var test;
}

If it is local, only that function/action can see or modify the value.


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
Page 1 of 2 1 2

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

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