|
|
Problem with events[GER/ENG]
#275267
06/30/09 19:28
06/30/09 19:28
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
German: Also, ich habe jetzt so oft events benutzt und es ging immer. Aber ich habe jetzt ein Problem und finde keine Lösung!
function WP_event()
{
var a;
if(event_type == EVENT_DETECT)
{
a = 1;
return(0);
}
}
//uses: ID,youID1,youID2,youID3,youID4
action WP_initialisieren()
{
STRING* sName ="#20";
my.emask |= (ENABLE_DETECT);
my.event = WP_event;
str_for_entname(sName,me);
my.ID = str_to_num(str_clip(sName,13));//Waypoint_mdl_001 wird zu 001
wait(3);//Warte bis sich die Waypoints eingeloggt haben
c_scan(my.x,0,vector(360,0,128),IGNORE_ME);//Scanne nach erreichbaren nodes
}
Also das event war ein anderes aber immer wenn es aufgerufen wird crasht es noch bevor es etwas macht. Desswegen habe ich es nur durch a = 1 ersetzt. Wenn ich einen Breakpoint in der WP_initialisieren drin hab dann läuft sie durch, jedoch nach dem scannen heißt es "crash in WP_event". Wenn ich keinen Breakpoint hab crasht schon Die WP_initialisieren. Davor habe ich nurnoch
#define ID skill51
#define youID1 skill52
#define youID2 skill53
#define youID3 skill54
#define youID4 skill55
und die normalen Includes stehen English ( a little bit shorter^^) The upper first code doesn't work. It just gives me a "crash in WP_event". Before these function and action only stands the upper defines and the normal includes. The program doesn't even run the "a=1;" It crashes as soon it get called by the c_scan
Last edited by Nicotin; 07/02/09 08:25.
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275288
06/30/09 21:42
06/30/09 21:42
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I dont knoww how this is even compiling. Count the number of "curly-brackets" in WP_event.. it is missing a "}". This should cause the compiler to fail...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Problem with events[GER/ENG]
[Re: EvilSOB]
#275290
06/30/09 21:47
06/30/09 21:47
|
Joined: Aug 2005
Posts: 512 Bayern
Schmerzmittel
User
|
User
Joined: Aug 2005
Posts: 512
Bayern
|
Jep EvilSob hat recht. Es fehlt ein } am Ende von deinem Event.
A7 Com V7.80
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275483
07/01/09 13:52
07/01/09 13:52
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Oh sorry. I just cut out the comments in this function and accidently cut out the bracket too. Of course it is
function WP_event()
{
var a;
if(event_type == EVENT_DETECT)
{
a = 1;
return(0);
}
}
EDIT: Ok ich verzweifel hier. Hier mal das ganze Script...ist nicht viel. Aber ich versteh es einfach nicht. Zur Info. Die Waypoints heißen alle wie gewohnt "Waypoint_mdl_001 ....003" #include <acknex.h> // includen Sie diese vordefinierten, benötigten Dateien in unser Projekt #include <default.c>
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Includes///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Variablen///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Strings///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Bitmaps///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Fonts///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Funktions-Prototypen////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Defines///////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// #define ID skill51 #define youID1 skill52 #define youID2 skill53 #define youID3 skill54 #define youID4 skill55
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Pointer///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Panels///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Aktionen///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
function WP_event() { var a; //Setze die ID's der umliegenden Nodes if(event_type == EVENT_DETECT) { a = 1; // if(my.youID1 == 0) // { // my.youID1 = you.ID; // return(1); // } // else // { // if(my.youID2 == 0) // { // my.youID2 = you.ID; // return(1); // } // else // { // if(my.youID3 == 0) // { // my.youID3 = you.ID; // return(1); // } // else // { // if(my.youID4 == 0) // { // my.youID4 = you.ID; // return(1); // } // } // } // } } return(0); } //uses: ID,youID1,youID2,youID3,youID4 action WP_initialisieren() { STRING* sName ="#20"; my.emask |= (ENABLE_DETECT); my.event = WP_event; wait(1); str_for_entname(sName,me); str_clip(sName,13); my.ID = str_to_num(sName);//Waypoint_mdl_001 wird zu 001 wait(3);//Warte bis sich die Waypoints eingeloggt haben c_scan(my.x,0,vector(360,0,128),IGNORE_ME);//Scanne nach erreichbaren nodes }
action car() {
c_trace(my.x,vector(my.x,my.y,0),IGNORE_ME); if(!you) { ent_remove(me); } } ///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////Funktionen///////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
function main() { level_load("Test.wmb"); wait(3); }
Last edited by Nicotin; 07/01/09 19:33.
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275613
07/02/09 00:43
07/02/09 00:43
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Ive never tried, but I think its "illegal" to return a value from an event.
function WP_event()
{
var a;
if(event_type == EVENT_DETECT)
{
a = 1;
return;
}
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275662
07/02/09 06:48
07/02/09 06:48
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Could be. but it still doesn't work after removing. Also the code already crashes before it do something. Even a isn't set to 1. If I have no breakpoint in WP_initialisieren, then it even crashes already in this function. I don't know what to do.
I wanted to test it and put a "wait(-5);" in the first line of "WP_initialisieren" it doesn't even do the wait part and crashes immediately. It has to be something with the defines of my level.
EDIT: In the Level only is one big Block and 3 Poles with the name "Waypoint_mdl_001" to 003. They have the flag "passable" and the action "WP_initialisieren"
Last edited by Nicotin; 07/02/09 06:54.
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275692
07/02/09 08:13
07/02/09 08:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I dont get it, but then I am quite poor with C-Script. One thing to try though, try this version of the action AS A TEST.
action WP_initialisieren()
{
my.emask |= (ENABLE_DETECT);
my.event = WP_event;
wait(1);
// STRING* sName ="#20";
// str_for_entname(sName,me);
// str_clip(sName,13);
// my.ID = str_to_num(sName);//Waypoint_mdl_001 wird zu 001
my.id = my.skill1;
wait(3);//Warte bis sich die Waypoints eingeloggt haben
c_scan(my.x,0,vector(360,0,128),IGNORE_ME);//Scanne nach erreichbaren nodes
}
AND put the numbers 1,2, and 3 into skill1 of the entities in WED, save/recompile etc. I have a sneaking suspicion it may be something to do with the STRING*....
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275700
07/02/09 08:22
07/02/09 08:22
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Oh, I thought this already was Lite-C. Seems like I still don't able to seperate the bouth Languages^^. I've done it but it changes nothing. Like I sayed. It crashes as the function is called. Not inside.
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275744
07/02/09 09:34
07/02/09 09:34
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Sorry, my mistake. I was getting my thoughts tangled with another thread. This IS lite-c.
Anyway, Ive found the problem, by actually TESTING your code. I should have just done that before...
The problem is your c_scan. The second parameter is an angle, but you just gave it '0'. it needs to be c_scan(my.x,nullvector,vector(360,0,128),IGNORE_ME);
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Problem with events[GER/ENG]
[Re: Nicotin]
#275747
07/02/09 09:41
07/02/09 09:41
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Ah, thank you very much. It works. I looked over and over but couldn't find this ^^. Thank you very much. Finally I can go on.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|