FrikFile tutorial??

Discuss programming in the QuakeC language.
Post Reply
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

FrikFile tutorial??

Post by drm_wayne »

is there a Frikfile tutorial somewhere?
I want to use it to store and reload my current weapons, ammo, clips and health between the levels.
Im using a scratch qc so i dont use any of the old quakestuff..
Nahuel
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: FrikFile tutorial??

Post by Nahuel »

hello mrwayne, using frik file stuff is very easy, you can see a clear example of this use here
http://www.mediafire.com/download/szo8y ... Ceriux.rar
In this example, i am using frik file instead some stats :)
hi, I am nahuel, I love quake and qc.
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: FrikFile tutorial??

Post by drm_wayne »

thx im going too look into that :D

So i can basicially save anything with frikfile?
What about custom ammo, stats and weapons?

I dont use parm1, parm2 etc for giving the player items.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: FrikFile tutorial??

Post by Spike »

frik_file supports only strings. note that you can read/write floats/vectors via using stof/ftos / stov/vtos.
fopen returns -1 on failure, not 0.
empty lines return "" while EOF returns string_null. if (strvalue) will evaluate to true for "" and false for the null string.
don't forget to close your file. just because its good to clean up after yourself.
there's no seek support or binary files, so generally you'll want to read everything in and work in memory instead of constantly refering to the file.
\n denotes the end of a line. strings that contain that character (like centerprint messages) can thus be awkward to save.

you can use frik_file for inventory systems between maps, but you'll have to be sure to avoid issues with saved games etc. players joining midgame will require extra care.
in a deathmatch game on a public server, you probably don't want to create a new file for every player, or someone will waste all your diskspace citing 'for the luls'. there's no real way to delete files again.
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: FrikFile tutorial??

Post by drm_wayne »

thanks for the infos ;)

I just going to use it in SP, for MP i will use a different way to give the players their weapons and stuff :)
Post Reply