Gamestudio Links
Zorro Links
Newest Posts
How to buy tomorrow at open?
by frutza. 06/01/23 19:58
Adding Position to Current Trade
by AndrewAMD. 05/30/23 10:34
Unable to change multiplier of contract
by vicknick. 05/30/23 06:56
Wrong Definition of Sharpe Ratio in Zorro?
by vicknick. 05/29/23 06:32
Backtest strategy on bitcoin/crypto
by JamesHH. 05/26/23 04:36
Return type of floor()
by AndrewAMD. 05/25/23 14:17
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (AndrewAMD), 1,065 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
BInnacle, androsa, XquicksnowX, danishinvest, Trail
18942 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A little help for a n00b #366158
04/01/11 18:28
04/01/11 18:28
Joined: Apr 2011
Posts: 2
D
Darkflare19 Offline OP
Guest
Darkflare19  Offline OP
Guest
D

Joined: Apr 2011
Posts: 2
hey, couple of simple questions

How do you use 'accelerate' without the system crashing and I mean a simple program I'm literally messing about with script 18 from the online tutorial pack of scripts.

var accel = 5
var accelneg = -5
function main()
{
level_load ("work18.wmb");

}

action move_me()
{
while(!key_cuu) wait(1); // wait for up key
while(1)
{
if (key_cuu) accelerate(NULL, accel, 1) ;
if (key_cud) accelerate(NULL, accelneg, 1);


var distance_fwdorbck = (key_cuu-key_cud) *5*time_step;

c_move(me, vector(distance_fwdorbck,0,0), NULL, GLIDE);
my.pan += (key_cul-key_cur)*2*time_step;
wait(1);
}
}

It runs the program fine, but then says system crash in move_me: SYS in an error window when I run the program and press up.

If you don't know why the above happens could you tell me how to accelerate an object another way

Cheers.

Re: A little help for a n00b [Re: Darkflare19] #366162
04/01/11 18:49
04/01/11 18:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
You can't pass NULL as the first parameter to accelerate. It needs a pointer to a var, and it will change the value stored in this var.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: A little help for a n00b [Re: JibbSmart] #366164
04/01/11 18:58
04/01/11 18:58
Joined: Apr 2011
Posts: 2
D
Darkflare19 Offline OP
Guest
Darkflare19  Offline OP
Guest
D

Joined: Apr 2011
Posts: 2
Cheers, I got rid of the NULL and replaced them both with distance_fwdorbck (which is the variable (key_cuu-key_cud)*5

And it doesn't crash anymore, but it doesn't accelerate either, just stays at a constant speed.

Anyway could I make the object accelerate at a certain rate?

Or is there anyway I could increment the variable above by a certain amount every second the corresponding button is being held down?

Thanks again.

Re: A little help for a n00b [Re: Darkflare19] #366169
04/01/11 19:19
04/01/11 19:19
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Perhaps reduce the friction (third parameter)?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

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