Forums Index >> Modding >> How to get past the "Open for append" bug for mac?



Page : <1> :


In certain scripts like the ban script, the message logger, and any others that require TT to write to an external log file, or registry, almost all current scripts invoke the OpenForAppend command. Unfortunatly, I can't get OpenForAppend to work on my mac. Is there a way around this?

Wednesday, January 05, 2005 at 7:36:18 AM

Dash said that u must use a folder like ~/etc.. And just not game/etc.. I tried it but it never worked, theres another way -- Open For Write -- but it deletes all lines in the file to make the new log so when u turn off TT u just got the last line logged..
Want it?
Get a Windows or a Linux


Wednesday, January 05, 2005 at 9:21:34 AM

Art: ~/ is an abbreviation for a users home folder. I don't see how that would help. Unless it refered it to TT's home folder, which I doubt very much. I don't think my computer can find the function OpenForAppend. So I HAVE to use OpenForWrite, but can one reposition the write "cursor" or somthing? Unless someone has the OpenForAppend function lying around that is.

 

Wednesday, January 05, 2005 at 10:38:35 AM

Its not that -- the problem is MAC finding the file -- thats wat dash told me lol u can try and get it from TGE tough but I think its on C code

Dash says that not using ~/ will make MAC users search everywhere on the computer not finding it but I dont know

PS: are u using -nohomedirectory when launching TT?


Last edited: Wednesday, January 05, 2005 at 10:43:10 AM

Wednesday, January 05, 2005 at 10:41:46 AM

?......

Wednesday, January 05, 2005 at 2:21:46 PM

@Art: ~/ is the shortcut to the home directory. This is kernel level and TT affects all programs, including TT. Hence, if I type ~/game/server/scripts TT looks in /Users/ben/game/server/scripts which obviously does not exist. Okay, I'll try to find the function in TGE... *Groans at prospect of looking through all of TGE source*

 

Anyway, a way to use the "Open for Append" command, is to mess with the TGE C++ source, build an application, make it launch when you launch ThinkTanks, and VIOLA! It should then work!

 

Ya Nick, just like that... Nice and easy, mess around with 40 source files, find the right function, then simply create an application. Lol. The finding will be the hard part. It might be easier to use google than looking through all of TGE.

Anyway, thanks for the help. I'll try to find the OpenForAppend function. Once I find it the rest shouldn't be too hard.

Ben

P.S. Mac is not an acronym. Mac is an abbreviation for Macintosh and should be spelt as "Mac" Not as "MAC". I know, I know, it's silly to complain about but...

Update: I've searched google for "openforappend" and it got me eight results. None of them where the actual function. This seems to be a little-used, single platform command with no documentation or anything of that sort. Is there some way I could openforread the file, read the ENTIRE file and then WRITE the file back again, then write another line before closing the function? Maybe OpenForReadWrite?

P.P.S. Nick, there is only one Linux build that runs on the PowerPC processor: Yellow Dog Linux.

Last edited: Wednesday, January 05, 2005 at 6:22:18 PM

Wednesday, January 05, 2005 at 4:00:52 PM

After three hours, I got this:

 

If(%banlist.openForRead("game/server/logs/banlist.cs") && %banlist.openForWrite("game/server/logs/banlist.cs"))
{

%banlist_entry = %banlist.readLine(1);
echo(%banlist_entry);
%banlist.writeLine(%banlist_entry);
%banlist.writeLine(%client.nameBase@":"@%ip);
//%client.delete("YOU HAVE BEEN BANNED FOR BAD BEHAVIOR.");
centerprintall(%client.nameBase@" HAS BEEN BANNED FOR BAD BEHAVIOR", 4);

%banlist.close();


return;
}

 

Which works for two lines, if anyone with more knowledge of writeline feels inspired to make this into some kind of loop for me, I'd be very grateful.

*Yawn*

Ben

Last edited: Wednesday, January 05, 2005 at 7:35:00 PM

Wednesday, January 05, 2005 at 7:34:24 PM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald