ItsMods

Full Version: OpenFile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So I want to create a file and write something to it,
With the power of google I found out you could use OpenFile and fprintln for it,
So I wrote this code:

Code:
f = OpenFile( file, "write" );
fprintln(f, "test");

I runned it and got

Code:
====================================================
Com_ERROR:  Server script compile error
return value of developer command can not be accessed if not in a /# ... #/ comment
maps/mp/gametypes/me.gsc(168):
  f = OpenFile( file, "write" );
(see console for details)

====================================================

Okay this isnt such a problem? - I thought.
So i changed it to:

Code:
/# iprintln("File id = "+OpenFile( file, "write" )); #/

But now nothing shows up at all when I run the function Sad

EDIT: if you guys have some other way to write stuff to a file, its also okay
When using "/#" & "#/" it means it will only read that part of the code when developer_script is set to 1.
you should use /* */ maybe ?
3arc uses /* */, try it
thnx guys, trying now..
nope none of these methods work Sad
is there some way I can write something to a file?
OpenFile is a developer command that requires developer_script to be set to 1 and the code must be put in between a forward slash and hash symbol thingy
/#
//developer commands here
#/

@OrangePL was trolling if you didn't notice because if you were smart enough, you'd know that /* */ simply comments out your code, making it not run. Nyan Cat

You sure you didn't add this to your code and restart the map?
setDvar("developer_script", "1");
People who are saying put it in /**/ have no idea what they're on about. Put it in /##/ and set developer_script to 1. Also the function probably doesn't work as they've probably removed it like in previous cod titles.
/*this is
commented out*/
//just like this
this is not
/#this is
DEVELARTA#/
Yeah I already knew /* */ is comment, but i'm new to the black ops modding scene (im a pretty expierenced programmer though) so i thought it could be legit

Anyway I changed the dvar, with exactly the same function you guys said,
Still doesnt give a fuck though,
Is there some other way to write stuff to a file, I dont really care where as long as I can read the output back later
(07-28-2011, 14:28)jariz Wrote: [ -> ]Anyway I changed the dvar, with exactly the same function you guys said,
Still doesnt give a fuck though,
Is there some other way to write stuff to a file, I dont really care wherem as long as I can read the output back later

Code:
/logfile 1

println("");
logprint("");

<mod dir>\console_mp.log
Pages: 1 2