2 registered members (VoroneTZ, 7th_zorro),
1,071
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
SED Script Editor is crashing
#224587
08/31/08 05:38
08/31/08 05:38
|
Joined: Jun 2008
Posts: 40
pfeldman
OP
Newbie
|
OP
Newbie
Joined: Jun 2008
Posts: 40
|
When I attempt to run the following program in debug mode, the SED Script Editor crashes ("Script Editor has encountered an error and needs to close.") There is undoubtedly something bad going on in this code, but the Script Editor should not crash.
#include <acknex.h> #include <default.c>
var Mode= 0; var t_1, t_2;
TEXT* user_txt= { pos_x = 100; pos_y = 200; font = "Arial#24bi"; flags= VISIBLE; strings= 2; }
// Player #1's displayed clock time:
TEXT* time_txt_1= { pos_x = 100; pos_y = 300; font = "Arial#60b"; flags= VISIBLE; strings= 2; }
// Player #2's displayed clock time:
TEXT* time_txt_2= { pos_x = 450; pos_y = 300; font = "Arial#60b"; flags= VISIBLE; strings= 2; }
function spacebar_press() {
switch(Mode) {
// Mode == 0 means that play has not yet started, so start it now: case 0: Mode= 1; // Update help text: str_cpy( (user_txt.pstring)[0], "Press spacebar to switch clocks."); break;
// Mode == 1 means that it is player #1's turn and that the game is // not currently paused: case 1: // Update displayed time on screen: str_cpy( (time_txt_1.pstring)[0], "Player 1: "); str_cpy( (time_txt_1.pstring)[1], ""); str_cat_num( (time_txt_1.pstring)[1], "%0.1f", t_1); Mode= 2; break;
// Mode == 2 means that it is player #2's turn and that the game is // not currently paused: case 2: // Update displayed time on screen: str_cpy( (time_txt_2.pstring)[0], "Player 2: "); str_cpy( (time_txt_2.pstring)[1], ""); str_cat_num( (time_txt_2.pstring)[1], "%0.1f", t_2); Mode= 1; break;
}
}
// ------------------------------------------------------------------------
function main() {
video_mode = 7; // create a program window of 800x600 pixels screen_color.blue = 50; // and make its background dark blue
str_cpy( (user_txt.pstring)[0], "Enter initial time in minutes (default= 10): ");
// Wait for user to type something (or nothing) followed by Enter: inkey((user_txt.pstring)[1]);
// Convert user input string to a number and convert number to seconds: t_2= t_1= 60 * str_to_num((user_txt.pstring)[1]);
if (t_1 <= 0) { t_2= t_1= 600; // Assign default value. }
// Display initial times: str_cpy( (time_txt_1.pstring)[0], "Player 1: "); str_cpy( (time_txt_1.pstring)[1], ""); str_cat_num( (time_txt_1.pstring)[1], "%0.1f", t_1);
str_cpy( (time_txt_2.pstring)[0], "Player 2: "); str_cpy( (time_txt_2.pstring)[1], ""); str_cat_num( (time_txt_2.pstring)[1], "%0.1f", t_2);
// Display initial help text: str_cpy( (user_txt.pstring)[0], "Press spacebar to start clock #1.");
on_space= spacebar_press;
while (1) {
// Wait for half a second: wait(-0.5);
// Player #1's turn:
if (Mode == 1) {
// Decrement player #1's time: t_1-= 0.5;
// Update displayed time on screen: str_cpy( (time_txt_1.pstring)[0], "Player 1: "); str_cpy( (time_txt_1.pstring)[1], ""); str_cat_num( (time_txt_1.pstring)[1], "%0.1f", t_1);
// If out of time, terminate the program: if (t_1 <= 0) break; }
// Player #2's turn:
if (Mode == 2) {
// Decrement player #2's time: t_2-= 0.5;
// Update displayed time on screen: str_cpy( (time_txt_2.pstring)[0], "Player 2: "); str_cpy( (time_txt_2.pstring)[1], ""); str_cat_num( (time_txt_2.pstring)[1], "%0.1f", t_2);
// If out of time, terminate the program: if (t_2 <= 0) break; }
}
}
|
|
|
Re: SED Script Editor is crashing
[Re: pfeldman]
#224635
08/31/08 14:12
08/31/08 14:12
|
cemetarycat
Unregistered
|
cemetarycat
Unregistered
|
meow wow! thats a long program. I'll copy n paste it in. although, I think I know what is wrong. I think.... I'll be back... to edit this, this post/reply. um...meow!!, you're right. It compiles good. But with just a blank screen. I think I see what you are doing with the TEXT objects containing its own string or strings. But, do you have to declare your own strings? And with STRING objects? Of STRING* name;
Last edited by cemetarycat; 08/31/08 14:25.
|
|
|
Re: SED Script Editor is crashing
[Re: jcl]
#225313
09/03/08 22:59
09/03/08 22:59
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
I too have this error since I updated to vista and I can't develop with it. It's often unclear to me which version is meant in the bug list. I have 3dgs version 7.10 but SED version 7.06, and SED keeps crashing with buggy code. Script bugs in lite-C sometimes caused a real crash instead of a crash message from the engine (A7.05 and above; fixed in A7.08.1). Workaround: Avoid bugs in your script. So, it is said that A7.10 it shouldn't occur, yet for me it does...
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: SED Script Editor is crashing
[Re: Joozey]
#225369
09/04/08 07:54
09/04/08 07:54
|
Joined: Jul 2000
Posts: 27,986 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,986
Frankfurt
|
When a bug was fixed in version 7.08, and you have version 7.10, the bug is also fixed in your version - if that was your question.
You can easily test that buggy code causes an error message, not a crash. For instance, the bug in the code above is apparently calling inkey with an empty string, and will issue a "crash in main" message. This has nothing to do with Vista. So I can't comment your debugging problems.
However you'll indeed get a real crash when the problem does not occur immediately or leads to subsequent internal crashes. For instance, when you load a damaged sound file, the code can run fine but SED will crash when the sound is played by an entity. Code crashes can be encapsulated, but sound driver crashes or internal crashes can't.
|
|
|
|