Page 1 of 1
How do you save variables?
Posted: Sat Jun 23, 2012 9:32 am
by Catastrophe
.
RE: How do you save variables?
Posted: Sat Jun 23, 2012 9:57 am
by Ijon Tichy
Well, these days you have access to StrParam, so something like this would work
Code: Select all
function void saveCVar(int cvar, int val)
{
int query = StrParam(s:"set ", s:cvar, s:" ", d:val);
int query2 = StrParam(s:"archivecvar ", s:cvar);
ConsoleCommand(query);
ConsoleCommand(query2);
}
Note that this is EXTREMELY easy to screw with, so don't use it if you can avoid it.
RE: How do you save variables?
Posted: Sat Jun 23, 2012 10:28 am
by Catastrophe
.
RE: How do you save variables?
Posted: Sat Jun 23, 2012 10:43 am
by Ijon Tichy
If we're using it on the client side to save user variables:
> ACS script does saveCVar("herp_derp", 42)
> user promptly puts in "herp_derp 9239"
> later ACS script does GetCVar("herp_derp")
Yeah.
.
Posted: Sat Jun 23, 2012 10:54 am
by Catastrophe
.
RE: How do you save variables?
Posted: Sat Jun 23, 2012 11:05 am
by Ivan
The best method of doing it is the way the ranker works in Jumpmaze if it's essential to your game. Or else, the way ZH did their achievements could be a nice way for you.
Is it for hats/pets ? :P
RE: How do you save variables?
Posted: Sat Jun 23, 2012 11:08 am
by Catastrophe
.
RE: How do you save variables?
Posted: Sat Jun 23, 2012 11:34 am
by Ivan
Catastrophe wrote:
Yep, I want to make it unlockable. How did ZH do it?
I wish I knew, I could use it or learn from it. :P
RE: How do you save variables?
Posted: Sat Jun 23, 2012 11:36 am
by Catastrophe
.
RE: How do you save variables?
Posted: Tue Jun 26, 2012 11:53 am
by ZzZombo
As I remember, ZH just encrypts their CVARs by some algorithm which was hacked later :(
RE: How do you save variables?
Posted: Thu Jun 28, 2012 8:12 am
by Ijon Tichy
okay i'm back
Catastrophe wrote:
Anyway to hide scripts? At least from an idiot that just lazily opened up slade?
you do realise it's a trivial matter to just do a diff on your config file and see which variables were added/removed/changed, right?
also,
listacs
Catastrophe wrote:
Yep, I want to make it unlockable. How did ZH do it?
if I had to guess, it used a multitude of obscurely named variables with some simple scrambling scheme, given how much of a pain in the ass it would be (and how completely useless it would be in this case) to add something like twofish encryption, considering we get all of four bytes to easily work with
I have no idea, considering I haven't so much as looked at ZH for months
proper encryption in ACS is likely to remain a hard problem for a long time, by the way - although if I'm wrong and there's already been a cipher function made for ACS, I'm all ears
dear god does it sound painful to port, though
RE: How do you save variables?
Posted: Thu Jun 28, 2012 8:41 am
by XutaWoo
Keep in mind, most people have no obligation to play your mod. They just have to download it, and if they don't want it any more they can delete it and actually gain stuff. Granted, it's stuff they already had, but they're not wasting money or anything to gain it back.
Let people cheat if they want. If letting people have the unlockables would cause problems, the people who would unlock 'em would cause problems as well. Sure, people may be miffed when they spent however much time it takes to unlock the stuff and then a way to instantly unlock everything came out, but c'est la vie.
RE: How do you save variables?
Posted: Fri Jun 29, 2012 5:11 pm
by Watermelon
Blue msg me on TS (when you get back), I got a safe way to use StrParam cvar saving safely
RE: How do you save variables?
Posted: Sun Jul 01, 2012 8:04 pm
by Zupoman
Oh, I know how zh saves achievements. I know it because I was trying to find my .ini file, and looked at it "accidentally". Actually, it encodes it some way.
Code: Select all
x_zh_pro6=4632
x_zh_pro5=1728
x_zh_pro4=3438
x_zh_pro3=8740
x_zh_pro2=15687
x_zh_pro1=105468
x_zh_pro0=188
x_zh_global3=135280
x_zh_global2=119497
x_zh_global1=102768
x_zh_global0=130
Copy it into your ini file into correct place and you will have my achievements.
Tho, I think that this can be improved that just copying it to your .ini file won't give you all things.
I've never messed up with those CVAR things, so I may say something stupid, but:
You can try dividing/multipling those variables with things from playerinfo CCMD, causing some magic effects, and then encoding it by multipling/dividing them again, but oppositely. This can give you big advantage over those biatches that want everything free for them.