Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenFile
#1
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
Reply

#2
When using "/#" & "#/" it means it will only read that part of the code when developer_script is set to 1.
Reply

#3
you should use /* */ maybe ?
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#4
3arc uses /* */, try it
[Image: lQDUjba.jpg]
Reply

#5
thnx guys, trying now..
nope none of these methods work Sad
is there some way I can write something to a file?
Reply

#6
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");
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Reply

#7
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.
Reply

#8
/*this is
commented out*/
//just like this
this is not
/#this is
DEVELARTA#/
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#9
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
Reply

#10
(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
[Image: b_560_95_1.png]
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.