2 registered members (TipmyPip, 1 invisible),
18,758
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Convert from Lite-C to C
[Re: kasimir]
#242385
12/22/08 20:22
12/22/08 20:22
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
you have to define my and it's properties, it seems pretty senseless to convert this to c for me. unless if you mean c-script  for c-script delete first 2 lines and delete () from action flashing_lkights
3333333333
|
|
|
Re: Convert from Lite-C to C
[Re: Doof_Guy]
#242399
12/22/08 21:31
12/22/08 21:31
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
I know you did not ask for this, but that code can be shortened. (besides: I'm not sure if C-Script knows "else if" statements) Here is another version, which does the same (at least it should):
var counter = 0;
var lights_red[4] = 160, 0, 255, 255;
var lights_green[4] = 32, 255, 255, 0;
var lights_blue[4] = 240, 0, 0, 0;
function change_colour()
{
my.ambient = 500;
my.lightrange = 150;
while(1)
{
my.red = lights_red[counter];
my.green = lights_green[counter];
my.blue = lights_blue[counter];
counter += 1;
counter %= 4;
wait(-1);
}
}
action flashing_lights
{
change_colour();
}
function main()
{
level_load("test_light.wmb");
wait(1);
}
|
|
|
Re: Convert from Lite-C to C
[Re: Xarthor]
#242409
12/22/08 22:21
12/22/08 22:21
|
Joined: Oct 2008
Posts: 218 Nashua NH
heinekenbottle
Member
|
Member
Joined: Oct 2008
Posts: 218
Nashua NH
|
(besides: I'm not sure if C-Script knows "else if" statements)
Just FYI, it did.
|
|
|
|