Problme mit Lite-C

Posted By: White_Wolf

Problme mit Lite-C - 09/29/07 07:31

Hallo,

Ich versuche gerade die C-Scripte meines Spiels ins Lite-C umzuwandeln. Leider erhalte ich Fehlermeldungen. Und zwar habe ich mit dem Sound Definition. Laut Handbuch muss es ja so aussehen. SOUND* rain_wav = "rain.wav"; Leider meckert er trotzdem. Fehlermeldung: SOUND undeclared indentifer.

Was muss ich machen das es geht?

Tschau
White_Wolf
Posted By: jermy

Re: Problme mit Lite-C - 09/29/07 09:29

Hast du default.c und acknex.h included?
Posted By: White_Wolf

Re: Problme mit Lite-C - 09/29/07 10:21

Nein habe ich nicht. (Wusste nicht dass man dass muss). Werte es gleich mal machen.

Danke Jetzt meckert es es nicht mehr an.

Tschau
White_Wolf
Posted By: White_Wolf

Re: Problme mit Lite-C - 09/29/07 13:55

Habe jetzt ein neues Problem. Und zwar mit Buttons. Habe den Button so wie es im Handbuch steht definiert. Trotzdem kommt aber die Meldung: Syntax Error. (Rote Zeile wir angemeckert)

Code:
 PANEL menue1_pan = {
bmap = menue1;
layer = 20;
pos_x = 340; // for now
pos_y = 200; // for now
button(80,40,neuesspiel,neuesspiel,neuesspiel,neubeginnen,NULL,NULL);
flags = Overlay;
}



Dabei ist neuesspiel die Bitmap des Knopfes und neubeginnen die Funktion die beim anklicken des Knopfes ausgeführt werden soll.
Was ist da Falsch?
Tschau
White_Wolf
Posted By: HeelX

Re: Problme mit Lite-C - 09/29/07 14:04

Wenn du schon ein Panel initialisierst, dann musst du das Panel auch als PANEL*, also als Pointer schreiben. Wenn du also

Code:
PANEL* menue1_pan = {



schreibst, dann sollte der Compiler ohne Probleme kompilieren.
Posted By: White_Wolf

Re: Problme mit Lite-C - 09/29/07 14:59

Danke das hat das Problem behoben.

Tschau
White_Wolf
Posted By: White_Wolf

Re: Problme mit Lite-C - 10/03/07 16:16

Habe jetzt ein Neues Problem. Und zwar mit der Sichtbarmachung eines Panels.
Habe die Panel und das Sichtbarmachen wie folgt definiert.

Code:
 PANEL* main_pan = // main panel
{
bmap = main_pcx;
layer = 20;
pos_x = 220; // for now
pos_y = 200; // for now
flags = TRANSLUCENT,OVERLAY;
}

function start()
{
// breakpoint; // Zum Fehlertesten Aktivieren
on_esc = NULL; // don't exit the engine by Escape (default)
level_load (introlevel_wmb); // dummy level
wait (2);
main_pan.VISIBLE = ON; // show the main panel
mainmenu_mouse(); // and give me a cursor to play with
media_loop("pt.mp3",null,m_vol);
// snd_loop(pt,m_vol,0);
x = media_handle;
vec_set (camera.x, nullvector); // move camera to the origin
while (game_started == 0) // we haven't pressed New yet
{
camera.pan += 0.3 * time; // rotate the camera gently
camera.tilt += 0.1 * time;
camera.roll += 0.05 * time;
wait (1);
}

}




Leider erhalte ich einen Sytax error bei der Zeile main_pan.VISIBLE = ON; // show the main panel. Wo ist da der Fehler?

Tschau White_Wolf
Posted By: jermy

Re: Problme mit Lite-C - 10/03/07 16:31

ganz einfach
main_pan.VISIBLE=ON;
wird zu
main_pan.flags |= VISIBLE;
Posted By: White_Wolf

Re: Problme mit Lite-C - 10/03/07 19:37

Ok danke. Jetzt geht es.

Tschau
White_Wolf
Posted By: White_Wolf

Re: Problme mit Lite-C - 10/05/07 11:03

Hallo,

Habe ein neues Problem. Anscheinend gibt es in Lite-C keine Starter Funktionen mehr. Denn er meckert Sie an. Fehler: starter undeclared identifier.

Code:
 starter hide_old_panel()
{while (1)
{
game_panel.VISIBLE = off;
wait (1);
}
}



Wie muss ich dass ändern? Im Handbuch kommt kein sinnvolles Ergebnis wenn ich Starter suchen lasse.
Tschau
White_Wolf
Posted By: Lukas

Re: Problme mit Lite-C - 10/05/07 11:25

function hide_old_panel_startup ()
{...}

Posted By: deleRium

Re: Problme mit Lite-C - 10/05/07 11:25

http://www.conitec.net/beta/askript-befehl.htm

Quote:

Special functions
Events are functions ...

Functions ending with ..._startup are executed right after the main() function, and LC before the engine and video device is initialized. This way, every script can have its own startup function which initializes its variables or objects. Example:

Code:
function debug_startup() // automatically started if this script is included
{
debug_panel.visible = on;
while (1)
{ // run forever
debug_panel.pos_y = screen_size.y - 15;
fps = 0.9*fps + 0.1/time;
wait(1);
}
}





Posted By: Ottawa

Re: Problme mit Lite-C - 10/06/07 23:50

Hi!

Your using the c_cript format.

Check out "Flags at a glance" in the Lite-C contribution section

Ottawa
Posted By: White_Wolf

Re: Problme mit Lite-C - 10/07/07 19:16

Hi,

Ich habe ein neues Problem mit meinen Umwandel des C-Scriptes in Lite-C.
Und zwar meckert er das "X" (Rot makiert) in der Player Action an.
Fehlermeldung: x is not a member of function.

Code:
 action my_wwolf3()
{
player = my; // ich bin an jetzt die Spielfigur
my.health = 100; // Ich habe 100 Lebenspunkte
while(my.health > 0) // während meine Lebensenergie größer als 0 ist
{
player_dist.x = (key_pressed(move_forward)-key_pressed(move_back))*10*time_step;
player_dist.y = (key_pressed(move_left)-key_pressed(move_right))*10*time_step;

camera.tilt -= 10*-mouse_force.y*time;
player.pan -= 10*(mouse_force.x+(key_pressed(turn_left)-key_pressed(turn_right)))*time;

camera_pos();
schwerkraft();

if(key_pressed(run) == 1){player_dist.x *= 2; player_dist.y *= 2;}

if(key_pressed(jumpkey) == 1){jump();}
if(key_pressed(crawl) == 1)
{
player_dist.z-=10; //nach unten "schieben"
player_dist.x /= 2; //läuft langsamer
player_dist.y /= 2; //läuft langsamer
}
move_mode = ignore_PASSABLE+glide;
ent_move(player_dist, nullvector);
wait(1);
}
}



Was ist falsch?
Tschau
White_Wolf

@Ottawa

I transforme my C-Scribts to Lite-C.
Posted By: deleRium

Re: Problme mit Lite-C - 10/07/07 22:03

Wie hast du player_dist deklariert?
Posted By: TripleX

Re: Problme mit Lite-C - 10/07/07 22:10

falls es dir auffällt, ist wirklich JEDER Fehler den du hier beschrieben hast im Handbuch unter "Migration C-Script to C-Lite" beschrieben..

Beim lettzen Fehler musst du vermutlich .x durch [0], .y durch [1] und .z durch [2] ersetzen, da durch player_dist nicht als VECTOR sondern als var[3] definiert hast.

Handbuch: http://www.conitec.net/manual_d/litec_migration.htm
Posted By: White_Wolf

Re: Problme mit Lite-C - 10/08/07 07:35

@TripleX

Hallo,

ich habe eigentlich immer erst ins Handbuch geschaut. Mit der Suchfunktion (unter Index und Suchen) gesucht und erst wenn ich nix gefunden hatte (was selten passierte, da ich auch einiges mit dem Handbuch lösen könnte, aber halt nicht alles) gepostet. Vielleicht habe ich die Falschen Wörter und Begriffe gesucht.

Tschau
White_Wolf
Posted By: White_Wolf

Re: Problme mit Lite-C - 10/14/07 09:23

Hallo,

ich habe das Playerscript an Lite-C anpassen können. Doch leider geht es noch nicht richtig (das Bewegen funktioniert aber). Wenn ich die Sprungtaste drücke geht er zwar nach oben, fällt aber nicht wieder automatich nach unten, das selbe auch beim ducken nur halt umgekehrt.
Wo ist da der Fehler?

Code:
 var move_forward = 17;	
var move_back = 31;
var move_left = 30;
var move_right = 32;
var turn_left = 16;
var turn_right = 18;
var jumpkey = 56;
var crawl = 46;
var run = 42;

VECTOR player_dist;
VECTOR TEMP;
#define health skill1

function camera_pos()
{
camera.genius = player;
camera.x = player.x;
camera.y = player.y;
camera.z = player.z+30;
camera.pan = player.pan;
}

function schwerkraft()
{
vec_set (temp, my.x);
TEMP.z -= 1000;
trace_mode = IGNORE_ME + IGNORE_PASSABLE + USE_BOX;

my.skill3 = trace(my.x, temp);

if (my.skill3 > 2)
{
player_dist.z -= 2 * time_step;
}
else
{
player_dist.z = 0;
}
if (my.skill3 < 0)
{
player_dist.z += 2 * time_step;
}
}

var jump_time = 1;

function jump()
{

while (jump_time > -1)
{
player_dist.z = 30 * time_step * jump_time;
jump_time -= 0.11 * time_step;
if(my.skill3 < 2){jump_time = 1;break;}
wait (1);
}
while (key_pressed(jumpkey) == 1) {wait(1);}
jump_time = 1;
}


action my_wwolf3()
{
player = my; // ich bin an jetzt die Spielfigur
my.health = 100; // Ich habe 100 Lebenspunkte
while(my.health > 0) // während meine Lebensenergie größer als 0 ist
{
player_dist.x = (key_pressed(move_forward)-key_pressed(move_back))*10*time_step;
player_dist.y = (key_pressed(move_left)-key_pressed(move_right))*10*time_step;

camera.tilt -= 10*-mouse_force.y*time_step;
player.pan -= 10*(mouse_force.x+(key_pressed(turn_left)-key_pressed(turn_right)))*time_step;

camera_pos();
schwerkraft();

if(key_pressed(run) == 1){player_dist.x *= 2; player_dist.y *= 2;}

if(key_pressed(jumpkey) == 1){jump();}
if(key_pressed(crawl) == 1)
{
player_dist.z-=10; //nach unten "schieben"
player_dist.x /= 2; //läuft langsamer
player_dist.y /= 2; //läuft langsamer
}
move_mode = IGNORE_PASSABLE + GLIDE;
ent_move(player_dist, nullvector);
wait(1);
}
}


Posted By: deleRium

Re: Problme mit Lite-C - 10/15/07 19:20

Da ja niemand im ICQ zu erreichen ist, schreib ich eben hier

Tipp 1: Keine veralteten Befehle nutzen
Tipp 2:

Code:
var move_forward = 17;	
var move_back = 31;
var move_left = 30;
var move_right = 32;
var turn_left = 16;
var turn_right = 18;
var jumpkey = 56;
var crawl = 46;
var run = 42;

VECTOR player_dist;
VECTOR TEMP;
#define health skill1

function camera_pos()
{
camera.genius = player;
vec_set(camera.x,player.x);
camera.z = player.z+30;
camera.pan = player.pan;
}

function schwerkraft()
{
vec_set (TEMP, my.x);
TEMP.z -= 1000;

// trace_mode = IGNORE_ME + IGNORE_PASSABLE + USE_BOX; //ihhhgitt :D
// my.skill3 = trace(my.x, TEMP); //bäääääh :D

my.skill3 = c_trace(my.x, TEMP, IGNORE_ME + IGNORE_PASSABLE + USE_BOX); //besser :)

if (my.skill3 > 2)
{
player_dist.z -= 2 * time_step;
}
else
{
player_dist.z = 0;
}
if (my.skill3 < 0)
{
player_dist.z += 2 * time_step;
}
}

var jump_time = 1;

function jump()
{
//tüftel hier mal ein wenig rum ... wird noch net korrekt funzen :)
while (jump_time > -1)
{
player_dist.z = 30 * time_step * jump_time;
jump_time -= 0.11 * time_step;
if(my.skill3 < 2){jump_time = 1;break;}
wait (1);
}
while (key_pressed(jumpkey) == 1) {wait(1);}
jump_time = 1;
}


action my_wwolf3()
{
player = my; // ich bin an jetzt die Spielfigur
my.health = 100; // Ich habe 100 Lebenspunkte
watched = me; //Is ne lustige Zeile zum Kontrollieren ;)
while(my.health > 0) // während meine Lebensenergie größer als 0 ist
{
player_dist.x = (key_pressed(move_forward)-key_pressed(move_back))*10*time_step;
player_dist.y = (key_pressed(move_left)-key_pressed(move_right))*10*time_step;

camera.tilt -= 10*-mouse_force.y*time_step;
player.pan -= 10*(mouse_force.x+(key_pressed(turn_left)-key_pressed(turn_right)))*time_step;

camera_pos();
schwerkraft();

if(key_pressed(run) == 1){player_dist.x *= 2; player_dist.y *= 2;}

if(key_pressed(jumpkey) == 1){jump();}
if(key_pressed(crawl) == 1)
{
player_dist.z-=10; //nach unten "schieben"
player_dist.x /= 2; //läuft langsamer
player_dist.y /= 2; //läuft langsamer
}
move_mode = IGNORE_PASSABLE + GLIDE;
ent_move(player_dist, nullvector);
wait(1);
}
}



Will noch mehr Probleme ... mir ist langweilig
© 2024 lite-C Forums