|
2 registered members (TipmyPip, JeyKey II),
8,843
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
"Too many Functions" - Error
#290982
09/22/09 18:29
09/22/09 18:29
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Hi,
I have a problem: When I compile my script it says "Too many functions"..How could that be? I saw much more complex games and they don't hat that problem. I have about 10-14 functions, mostly actions for entites that are moving....Can yiu help me?
Thanks
Liam
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: "Too many Functions" - Error
[Re: Liamissimo]
#291002
09/22/09 20:22
09/22/09 20:22
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>;
///////////////////////////////////////////////////////////////
VECTOR ball_speed; // Ein Vektor für die Geschwindigkeit des Balles.
var tuer_oben = 0;
var boost_ball = 0;
var springen = 0;
var transporter_weg = 0;
ENTITY* drehende_kugel;
ENTITY* transporter;
ENTITY* ball; // Unser Ball als Objekt bestimmt
ENTITY* laser_strahler;
ENTITY* tuer;
ENTITY* rotoren;
STRING* r_blick_str = "R - VOGELPERSPEKTIVE(HALTEN)";
STRING* springen = "SPACE - Springen";
STRING* esc_str = "ESC - SCHLIESSEN"; //Der Platzhaltertext für Deppen damit die wissen wie sie es schliessen.
TEXT* quit_txt = //Ein neuer Text wird gemacht, mit dem oberen String
{
pos_x = 15;
pos_y = 15;
layer = 1; //Unterster Layer
font = Arial#20b; //Schriftkonfiguration
string (esc_str, r_blick_str, springen); //Der Text ist der Text vom String Esc...
flags = SHOW; //Und man soll es ja auch sehen können!
}
action transporter_1()
{
transporter = me;
while(1)
{
if (transporter_weg != 800)
{
wait(-4);
while(transporter_weg != 800)
{
me.x += 1;
transporter_weg += 2;
wait(1);
}
}
if (transporter_weg == 800)
wait(-4);
{
while(transporter_weg != 0)
{
me.x -= 1;
transporter_weg -= 2;
wait(1);
}
}
wait(1);
}
}
action rotoren()
{
while(1)
{
rotoren = my;
my.pan += 1;
wait(1);
}
}
PANEL* Normal_pan =
{
pos_x = 0;
pos_y = 0;
layer = 1;
digits(30,30,4,*,1,transporter_weg);
button(800,0, "clicked.bmp", "notclicked.bmp", "over.bmp", easy(), NULL, NULL);
flags = OVERLAY | SHOW;
}
action rotating_lasers()
{
laser_strahler = my;
while(1)
{
my.pan += 1;
wait(1);
}
}
function tuer_open()
{
if (tuer_oben != 400)
{
while(tuer_oben <= 400)
{
c_move(me, vector(0,0, 5 * time_step), nullvector, 0);
tuer_oben += 5;
wait(1);
}
}
if (tuer_oben == 405)
{
wait(-5);
while(tuer_oben != 5)
{
c_move(me, vector(0,0,-5 * time_step), nullvector, 0);
tuer_oben -= 5;
wait(1);
}
}
}
action rotating_sphere()
{
drehende_kugel = my;
while(1)
{
my.tilt += 2;
my.pan += 6;
my.roll += 3;
wait(1);
}
}
function schneller()
{
while(mouse_left == 1)
{
ball_speed.x = 50 * (key_d - key_a); //Wir multipizieren 25 mit der Diferernz aus Taste d und a
ball_speed.y = 50 * (key_w - key_s); //Dasselbe mit w und d
phent_addtorqueglobal (ball, ball_speed);
wait(1);
}
}
action tuer_act()
{
tuer = my;
my.emask |= (ENABLE_IMPACT | ENABLE_PUSH);
my.event = tuer_open;
}
function easy()
{
}
action jump()//Die Aktion heisst jump
{
if (springen != 1)
{
ph_setgravity(vector(0,0,450));//Und damit man nach oben kommt, zieht einen die "Schwerkraft(jetzt erher Leichtkraft) schnell nach oben
wait(-0.5);//Doch damit es nicht zu hoch geht hört es nach 50 FPS wieer auf, also fast die hälfte da FPS Max bei 60 liegt. Halbe Sekunde also;)
ph_setgravity(vector(0,0,-500));//Und schneller als normal gehts wieder runter..
springen = 1;
wait(-1.5);
springen = 0;
}
}
function blick()//Die Funktion um von oben zu blicken wird gestartet
{
while(key_r) //Solange also "r" gedrückt ist...
{
camera.z = ball.z + 1400;//Geht die Kamera nach oben
camera.tilt = -90;//Neigt sich mehr zur Erde...
camera.x = ball.x;//Und bleibt mit dem Ball auf einer x Achse, also hat ihn immer im Bild.
wait(1);//Und damit alles nur in einem Bild abläuft ein wait(1), sonst würde versucht werden ALLES in nur ein Bild zu packen was halt nicht geht.
}
}
function quit()//Die Fuktion zum schliessen
{
sys_exit("");//sys(tem)_exit...Erklärt sich ja von selbst, diesmal wird WINDOWS angesprichen um das Fenster zu schliessen.
}
function main()//Hauptfunktion, darin ist das wichtigste zum Starten
{
video_mode = 8;
nexus = 20000;
level_load("Basis_lvl.wmb");//Lade mein tolles Level
wait (-5);//Warte 5 Sekunden bis es fertig ist, nur zur Sicherheit.
mouse_mode = 4;
ball = ent_create ("ball.mdl", vector(-1080, -130, 271), NULL); //Kreire unseren Ball und gebe ihm den Pointer ball, siehe auch oben ENTITY* ball
ph_setgravity (vector(0, 0, -386)); // // Normale Erdanziehungskraft
phent_settype (ball, PH_RIGID, PH_SPHERE); //Tut den Ball ins Physiksystem
phent_setmass (ball, 3, PH_SPHERE);//Setzt die Masse und das es ein Ball ist
phent_setfriction (ball, 60); //Und die Reibung unseres Freundes
phent_setdamping (ball, 40, 40); //Sowie die Dämpfung
phent_setelasticity (ball, 50, 20);//und die Elastizität, hier die mitte zwischen Flummi und Lehmkugel
on_space = jump;
on_mouse_left = schneller;
on_r = blick;// Auf Taste R liegt nun also die Funktion Blick
on_esc = quit;//Und auf ESC ligt die Aktion.....na was wohl;) quit
while (1)//Solange 1 = 1 ist, also unendlich
{
ball_speed.x = 25 * (key_d - key_a); //Wir multipizieren 25 mit der Diferernz aus Taste d und a
ball_speed.y = 25 * (key_w - key_s); //Dasselbe mit w und d
phent_addtorqueglobal (ball, ball_speed);//Und nun sagen wir der Ball soll sich drehen um sich überhaupt fortzubewegen, und zwar mit unserer ball_speed Variable
camera.x = ball.x - 200;//Kamera hnter dem Ball
camera.y = ball.y;
camera.z = ball.z + 600;
camera.tilt = -60;
wait (1);//Und bitte nicht alles in einem Bild machen wollen sondern immer das Bild erneueren
}
}
This is my code, yeah I have some infinite loops, I also augmented my nexus from 30 to 80 and 90 and 150 etc. But nothing changes...Thnaks for the reply
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: "Too many Functions" - Error
[Re: Liamissimo]
#291007
09/22/09 21:03
09/22/09 21:03
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
das sieht mir nach nem syntaxfehler aus, versuch das zu korrigieren:
if (transporter_weg == 800)
wait(-4);
{
naja, ist nicht alles gute programmierung, aber das sollte dann trotzdem laufen.
|
|
|
Re: "Too many Functions" - Error
[Re: Scorpion]
#291037
09/23/09 05:48
09/23/09 05:48
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Weird that you don't get an error regarding your function named "easy" I thought empty functions throw an error. So if you still encounter one after fixing the bug Scorpion pointed out, you might want to add a simple wait(1); to the function easy. Furthermore instead of using != for "not equal" you could (in this case) rather use < and > because you are increasing and decreasing a value. It might not yet be "better" because you use a fixed value of 2 which is added and subtracted from your var, but note that this is not framerate independent programming. On a more (or less) powerful computer the counting up and counting down might be faster (or slower). As I don't know about your project, this might be trouble for the gameplay experience, hence I recommend using a value multiplied by time_step. But if you do so, you have to use < and > (can also be <= and >=) for comparison. Because you may not reach the exact value of 0 or 800 (or whatever) if you multiply by time_step, thus create an endless running loop and crushing your game 
|
|
|
Re: "Too many Functions" - Error
[Re: Xarthor]
#291100
09/23/09 12:44
09/23/09 12:44
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Okay, thnaks, I know thr programming isn't that fine:D Still don't works, in the Help fron conitec the say I hsould increase the Nexus, defalut ist 30 but even If i set it up to 600 nothing changes....
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: "Too many Functions" - Error
[Re: Xarthor]
#291114
09/23/09 13:38
09/23/09 13:38
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
the action rotoren killed it, i try if it works if is use another action isntead of "rotoren".
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
|