Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 70 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
Author Topic: Reading a file
Mitch*
General Member
Since: Jan 23, 2007
Posts: 24
Last: Nov 10, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Aug. 21, 2012 01:44 pm
IzNoGoD writes...
Quote:
Tally writes...
Quote:
IzNoGoD writes...
Quote:
This code:
Code:

	waittillframeend;
	file=openfile("testfile","write");
	closefile(file);
	waittillframeend;
	file=openfile("testfile","read");
	if(file==-1)
		iprintln("FILE NOT FOUND");
	else
		closefile(file);


presents me with a nice "file not found" iprintln, while the file is in fact created!

edited on Aug. 20, 2012 04:01 pm by IzNoGoD


Works for me and many others - as I've been at pains to PROVE several times. I don't know what you want me to say other than that.


It is not that I dont believe you: I really do.

Id like to get it working on my install, thats all...
Ill try that awe mod today :)
If that works, I got some place to start from


Can it be when you run the openfile function?

For example:
At startup (before any waits) or after when a player joins. The awe mod runs the openfile function at start up. And login systems use it during the game.

edited on Aug. 21, 2012 06:45 am by Mitch*
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Aug. 21, 2012 08:00 pm
Mitch* writes...
Quote:
IzNoGoD writes...
Quote:
Tally writes...
Quote:
IzNoGoD writes...
Quote:
This code:
Code:

	waittillframeend;
	file=openfile("testfile","write");
	closefile(file);
	waittillframeend;
	file=openfile("testfile","read");
	if(file==-1)
		iprintln("FILE NOT FOUND");
	else
		closefile(file);


presents me with a nice "file not found" iprintln, while the file is in fact created!

edited on Aug. 20, 2012 04:01 pm by IzNoGoD


Works for me and many others - as I've been at pains to PROVE several times. I don't know what you want me to say other than that.


It is not that I dont believe you: I really do.

Id like to get it working on my install, thats all...
Ill try that awe mod today :)
If that works, I got some place to start from


Can it be when you run the openfile function?

For example:
At startup (before any waits) or after when a player joins. The awe mod runs the openfile function at start up. And login systems use it during the game.

edited on Aug. 21, 2012 06:45 am by Mitch*


This. Exactly this.

Doing the readfile at startup DOES work. Doing it any time later does not.
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 02:14 am
IzNoGoD writes...
Quote:
Mitch* writes...
Quote:
IzNoGoD writes...
Quote:
Tally writes...
Quote:
IzNoGoD writes...
Quote:
This code:
Code:

	waittillframeend;
	file=openfile("testfile","write");
	closefile(file);
	waittillframeend;
	file=openfile("testfile","read");
	if(file==-1)
		iprintln("FILE NOT FOUND");
	else
		closefile(file);


presents me with a nice "file not found" iprintln, while the file is in fact created!

edited on Aug. 20, 2012 04:01 pm by IzNoGoD


Works for me and many others - as I've been at pains to PROVE several times. I don't know what you want me to say other than that.


It is not that I dont believe you: I really do.

Id like to get it working on my install, thats all...
Ill try that awe mod today :)
If that works, I got some place to start from


Can it be when you run the openfile function?

For example:
At startup (before any waits) or after when a player joins. The awe mod runs the openfile function at start up. And login systems use it during the game.

edited on Aug. 21, 2012 06:45 am by Mitch*


This. Exactly this.

Doing the readfile at startup DOES work. Doing it any time later does not.


their we gooooo i knew tally couldnt just have some magical call of duty lol. good solve though always learning something new about these games
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 09:31 am
Hang on here. IznoGod is changing his story. He's gone from "read" doesn't work on a Listen server AT ALL; at ANY TIME. to: it works sometimes.

The brunt of this thread has been about me proving that it works on a Listen Server. And I did that because I got shot down by 2 people saying I was wrong. I proved my case. No one said anything about qualifying the statement to "it only works at match start".

The other day, I did a quick test to see if you could wait until gamestarted had been called on a Listen server, and I successfully got "read" to work past that. I did that by simply moving all the threads to start DOM gametype and the start spawns to the very end of Callback_StartGametype().

At this point in time I do not know how far past that point it will work. I will do some testing and see where the cut-off point it. But the important thing is, I have at least managed to get some of you guys to change your story from "it never works", to "it works sometimes".
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 09:57 am
Tally writes...
Quote:
Hang on here. IznoGod is changing his story. He's gone from "read" doesn't work on a Listen server AT ALL; at ANY TIME. to: it works sometimes.

The brunt of this thread has been about me proving that it works on a Listen Server. And I did that because I got shot down by 2 people saying I was wrong. I proved my case. No one said anything about qualifying the statement to "it only works at match start".

The other day, I did a quick test to see if you could wait until gamestarted had been called on a Listen server, and I successfully got "read" to work past that. I did that by simply moving all the threads to start DOM gametype and the start spawns to the very end of Callback_StartGametype().

At this point in time I do not know how far past that point it will work. I will do some testing and see where the cut-off point it. But the important thing is, I have at least managed to get some of you guys to change your story from "it never works", to "it works sometimes".


not that big of a deal that your making it lol, iznogod made all our heads turn twice when everyone said rotateable huds is impossible unless you do it frame by frame w.e and he proved us wrong, told him its impossible to make a uav he proved us wrong. you couldnt even tell us why that your "read" function worked and ours didnt so dont get on that big show boat yet lol. im just glad to see their is a way to make "read" work on dedicated 0. i helped this guy understand his mistake was trying to use read on dedicated 0 helped him clearly since he said thank you and obv he wasnt using it from startup. so thank you for pointing us to the right direction to finding this mistake we were all doing but no need to try to hop on a show boat to something u didnt even solve... u just told us were all wrong... the question from start was "how".
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 10:04 am
Tally writes...
Quote:
Sevenz writes...
Quote:
i tried the openfile functions myself twice, but it failed just like for others here. I really don't know why, might depend on the surrounding code (similar to precache stuff, which has to be done before any wait command). However, i do believe that it actually works, as i played meatbot mod myself!

Tally: Do you know if writing works for CoD4 SP in dev mode?


1. I believe timing is critical to the file functions as long as you wait until a frame ends. So, if you are using any file function during a game, and not before a match has started, use the waittillframeend function before you run your functions.

2. As memory serves me, all the file functions work in COD4 dev mode. They just don't work outside of dev mode, like they do in COD2.

EDIT -

Hang on, I remember Perry Hart (of Pezbot) saying something to me about writing to a file even in dev mode. But I can't for the life of me remember what it was. I know that I tried it as soon as the mod tools were out, and I remember all of the functions working. Still, my memory isn't what it used to be.


Tally is also changing his story. Here he claims that it should/could work NOT only on startup. This confused me thoroughly, because when i tried this, it didnt work. Thus i came to the conclusion (based on this comment stating that it should either work all the time with a waittillframeend in front of it or never at all) that it didnt work at all.

After some further investigation, I managed to get it to work on matchstart ONLY. With your claim in mind, i thought it was be best to clear up any confusion and post some final results.

Instead i get shot down for "altering my conclusion based on some more research" which should NEVER, EVER be done, unless claiming you never came to said first conclusion at all (which i dont, I just got a little confused by everybody rolling over one another about this)
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 10:10 am
ouch... here comes the lock[lol]
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 10:32 am
liltc64 writes...
Quote:
Tally writes...
Quote:
Hang on here. IznoGod is changing his story. He's gone from "read" doesn't work on a Listen server AT ALL; at ANY TIME. to: it works sometimes.

The brunt of this thread has been about me proving that it works on a Listen Server. And I did that because I got shot down by 2 people saying I was wrong. I proved my case. No one said anything about qualifying the statement to "it only works at match start".

The other day, I did a quick test to see if you could wait until gamestarted had been called on a Listen server, and I successfully got "read" to work past that. I did that by simply moving all the threads to start DOM gametype and the start spawns to the very end of Callback_StartGametype().

At this point in time I do not know how far past that point it will work. I will do some testing and see where the cut-off point it. But the important thing is, I have at least managed to get some of you guys to change your story from "it never works", to "it works sometimes".


not that big of a deal that your making it lol, iznogod made all our heads turn twice when everyone said rotateable huds is impossible unless you do it frame by frame w.e and he proved us wrong, told him its impossible to make a uav he proved us wrong. you couldnt even tell us why that your "read" function worked and ours didnt so dont get on that big show boat yet lol. im just glad to see their is a way to make "read" work on dedicated 0. i helped this guy understand his mistake was trying to use read on dedicated 0 helped him clearly since he said thank you and obv he wasnt using it from startup. so thank you for pointing us to the right direction to finding this mistake we were all doing but no need to try to hop on a show boat to something u didnt even solve... u just told us were all wrong... the question from start was "how".


I couldn't tell you why I got it working because I was pretty flummoxed that people were saying in 2012 that "read" doesn't work on a Listen server. To me, it just worked. We've been using it in mods since 2007. I have never stopped to question at what point it works, or at what point it stops working (which I still don't know).



Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 10:42 am
IzNoGoD writes...
Quote:
Tally writes...
Quote:
Sevenz writes...
Quote:
i tried the openfile functions myself twice, but it failed just like for others here. I really don't know why, might depend on the surrounding code (similar to precache stuff, which has to be done before any wait command). However, i do believe that it actually works, as i played meatbot mod myself!

Tally: Do you know if writing works for CoD4 SP in dev mode?


1. I believe timing is critical to the file functions as long as you wait until a frame ends. So, if you are using any file function during a game, and not before a match has started, use the waittillframeend function before you run your functions.

2. As memory serves me, all the file functions work in COD4 dev mode. They just don't work outside of dev mode, like they do in COD2.

EDIT -

Hang on, I remember Perry Hart (of Pezbot) saying something to me about writing to a file even in dev mode. But I can't for the life of me remember what it was. I know that I tried it as soon as the mod tools were out, and I remember all of the functions working. Still, my memory isn't what it used to be.


Tally is also changing his story. Here he claims that it should/could work NOT only on startup. This confused me thoroughly, because when i tried this, it didnt work. Thus i came to the conclusion (based on this comment stating that it should either work all the time with a waittillframeend in front of it or never at all) that it didnt work at all.

After some further investigation, I managed to get it to work on matchstart ONLY. With your claim in mind, i thought it was be best to clear up any confusion and post some final results.

Instead i get shot down for "altering my conclusion based on some more research" which should NEVER, EVER be done, unless claiming you never came to said first conclusion at all (which i dont, I just got a little confused by everybody rolling over one another about this)


I'm not changing my story fella. Right from the start I said "read" worked on a Listen server, to which you replied it didn't. AT NO STAGE was it ever stated that the issue was qualified: it works SOMETIMES.

Also, I never said it was wrong for you to change your mind. But to try to make out that you had been aware of the fact right from the start, but without saying so, is wrong. Especially if what you are trying to do is contradict someone. Remember: your post said this:

Quote:
n dedicated 0:

All filereads fail.
All filewrites succeed.
All fieappends succeed.


Which was in contradiction to my claim that all the file functions work on a Listen server. If you were aware of the cut-off point at which stage it stops working - something I was UNAWARE of - then you should have said so.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 10:51 am
Tally writes...
Quote:


Which was in contradiction to my claim that all the file functions work on a Listen server. If you were aware of the cut-off point at which stage it stops working - something I was UNAWARE of - then you should have said so.


Aah, you also didnt know wheter or not it worked after the gamestart. I misinterpreted from one of your posts then that it would either work all the time or not at all.

I should have added "my previous statement was wrong; here is the correct one:" to the post claiming that filereads at gamestart DO work.

Glad this issue has been resolved and clarified now. Back to making navigational mesh pathfinding then :)
Share |
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»