Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (vicknick, AndrewAMD), 1,292 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
savedir partly works partly fails? #294270
10/17/09 19:23
10/17/09 19:23
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
I haave defined in my code
'savedir "\\sd";'

So directory 'sd' is created, but if I then
open a file for write with
'fi_handle = file_open_write("fi.txt");'

it is created in my current directory not in 'sd'.

Why???? Anyone know???


Last edited by kiamonster; 10/17/09 19:24.
Re: savedir partly works partly fails? [Re: kiamonster] #294286
10/17/09 23:30
10/17/09 23:30
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
str_cpy(save_dir,"your folder name")


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: savedir partly works partly fails? [Re: Superku] #294290
10/18/09 00:38
10/18/09 00:38
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
Sorry H.F.
The saved program file as before went in 'sd',
but the text file is still created in my work folder.
Thanks for looking though!

Is this a bug?

Last edited by kiamonster; 10/18/09 00:41.
Re: savedir partly works partly fails? [Re: kiamonster] #294291
10/18/09 01:00
10/18/09 01:00
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Hm... make this line
str_cpy(save_dir,"your folder name")
the very first instruction in your main-function to make sure it's defined before file_open_write(...). Then delete =>

Quote:
I haave defined in my code
'savedir "\\sd";'



Should work! If it does not, try file_open_write("fi.ini"); because I know that this will work (with 7.80).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: savedir partly works partly fails? [Re: Superku] #294328
10/18/09 13:40
10/18/09 13:40
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
Hi H.F.
Sorry I didn't reply - went to bed (and pondered whether I was ever cut out for programming!)
That failed - still got savegame correctly in sd - but fi.ini in work.
Here is my programme - very cut down but runnable...
What am I doing wrong (apart from atempting programming!)...

////////////////////////////////////////////////////////////////////////
// A6 main wdl:
// Created by WED.
////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////
// The PATH keyword gives directories where template files can be found.
path "C:\\Conitec\\GStudio7\\template_6"; // Path to A6 templates directory
path "C:\\Conitec\\GStudio7\\template_6\\code"; // Path to A6 template code subdirectory
path "C:\\Conitec\\GStudio7\\templates\\images"; // Path to template image subdirectory
path "C:\\Conitec\\GStudio7\\templates\\sounds"; // Path to template sound subdirectory
path "C:\\Conitec\\GStudio7\\templates\\models"; // Path to template model subdirectory

/////////////////////////////////////////////////////////////////
// Filename of the starting level.
string level_str = <txt_fils.WMB>; // give file names in angular brackets

////////////////////////////////////////////////////////////////////////////
// Included files
include <gid01.wdl>; // global ids
include <display00.wdl>; // basic display settings

/////////////////////////////////////////////////////////////////
var fi_handle = 0;
var fo_handle = 0;
savedir "\\sd";
//string lf = "\n"; //line feed
/////////////////////////////////////////////////////////////////
// Desc: The main() function is started at game start
function main()
{
str_cpy(save_dir,"\\sd");
// set some common flags and variables
// freeze all entity functions
freeze_mode = 1;
// no level has been loaded yet...
gid01_level_state = gid01_level_not_loaded;

// entry: Warning Level (0,1, or 2)
// entry_help: Sets sensitivity to warnings (0 = none, 1 = some, 2 = all).
warn_level = 2; // announce bad texture sizes and bad wdl code

//?compatibilty = 6; // keep sun_color and ambient_color at their default settings

// entry: Starting Mouse Mode (0, 1, or 2)
mouse_mode = 0;

// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);
// now load the level
level_load(level_str);

wait(2); // let level load
// level should be loaded at this point...
gid01_level_state = gid01_level_loaded;

//+++ load starting values

// un-freeze the game
freeze_mode = 0;

// save start of game here
wait(6); // allow time for functions that wait for "gid01_level_loaded" to load
file_delete("start0.SAV"); // remove any old savefile
wait(1);
if( game_save("start",0,SV_ALL) <= 0)
{
diag("\nWARNING! main - Cannot save 'start' of level (ignore on restarts).");
}
else
{
diag("\nWDL: main - Game 'start' saved.");
}


fi_handle = file_open_write("fi.ini");
wait(3);
file_str_write (fi_handle,"Alex");
file_str_write (fi_handle,"\n");
file_str_write (fi_handle,"Esra");
file_str_write (fi_handle,"\n");
file_str_write (fi_handle,"John");
file_close (fi_handle);
wait(3);
beep();
exit;
}


// Desc: this is the function used to restart the game.
function main_restart_game()
{
// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);

// freeze the game
freeze_mode = 1;

if( game_load("start",0) <= 0)
{
diag("\nWARNING! main_restart_game - Cannot load 'start' of level.");
}
else
{
diag("\nWDL: main_restart_game - Game 'start' loaded");
}

// un-freeze the game
freeze_mode = 0;
}


// Desc: this is the function used to quit the game.
function main_quit()
{
//+++ // save global skills & strings
exit;
}

/////////////////////////////////////////////////////////////////
// The following definitions are for the pro edition window composer
// to define the start and exit window of the application.
WINDOW WINSTART
{
TITLE "3D GameStudio";
SIZE 480,320;
MODE IMAGE; //STANDARD;
BG_COLOR RGB(240,240,240);
FRAME FTYP1,0,0,480,320;
// BUTTON BUTTON_START,SYS_DEFAULT,"Start",400,288,72,24;
BUTTON BUTTON_QUIT,SYS_DEFAULT,"Abort",400,288,72,24;
TEXT_STDOUT "Arial",RGB(0,0,0),10,10,460,280;
}

/* no exit window at all..
WINDOW WINEND
{
TITLE "Finished";
SIZE 540,320;
MODE STANDARD;
BG_COLOR RGB(0,0,0);
TEXT_STDOUT "",RGB(255,40,40),10,20,520,270;

SET FONT "",RGB(0,255,255);
TEXT "Any key to exit",10,270;
}*/


/////////////////////////////////////////////////////////////////
//INCLUDE <debug.wdl>;

Re: savedir partly works partly fails? [Re: kiamonster] #294341
10/18/09 15:01
10/18/09 15:01
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
Got a work-around.
Lost th 'str_cpe line and opened the file
'fi_handle = file_open_write("sd\\fi.txt");'
Its not ideal or what the manual says but it works!

Re: savedir partly works partly fails? [Re: kiamonster] #294348
10/18/09 16:04
10/18/09 16:04
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Ok, you are using A6 wdl and I use A7.80 lite-c...
As far as I can remember you should delete the str_cpy(save_dir,...) line and define the save folder as you've had before. You could try instead of savedir "\\sd"; the following:
savedir "sd";
SAVEDIR "sd"; (was/is A6 case-sensitive? I don't think so)
string savedir = "sd";
and
file_open_write("%SAVE_DIR%\\fi.txt"); (this may only work in A7).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1