How do you save variables?
-
- Retired Staff / Community Team Member
- Posts: 2566
- Joined: Sat Jun 02, 2012 2:44 am
How do you save variables?
.
Last edited by Catastrophe on Fri May 11, 2018 7:32 pm, edited 1 time in total.
-
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
RE: How do you save variables?
Well, these days you have access to StrParam, so something like this would work
Note that this is EXTREMELY easy to screw with, so don't use it if you can avoid it.
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);
}
Last edited by Ijon Tichy on Sat Jun 23, 2012 10:03 am, edited 1 time in total.
-
- Retired Staff / Community Team Member
- Posts: 2566
- Joined: Sat Jun 02, 2012 2:44 am
RE: How do you save variables?
.
Last edited by Catastrophe on Fri May 11, 2018 7:32 pm, edited 1 time in total.
-
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
RE: How do you save variables?
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.
> ACS script does saveCVar("herp_derp", 42)
> user promptly puts in "herp_derp 9239"
> later ACS script does GetCVar("herp_derp")
Yeah.
-
- Retired Staff / Community Team Member
- Posts: 2566
- Joined: Sat Jun 02, 2012 2:44 am
RE: How do you save variables?
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
Is it for hats/pets ? :P
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
-
- Retired Staff / Community Team Member
- Posts: 2566
- Joined: Sat Jun 02, 2012 2:44 am
RE: How do you save variables?
.
Last edited by Catastrophe on Fri May 11, 2018 7:33 pm, edited 1 time in total.
RE: How do you save variables?
I wish I knew, I could use it or learn from it. :PCatastrophe wrote: Yep, I want to make it unlockable. How did ZH do it?
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
-
- Retired Staff / Community Team Member
- Posts: 2566
- Joined: Sat Jun 02, 2012 2:44 am
RE: How do you save variables?
.
Last edited by Catastrophe on Fri May 11, 2018 7:33 pm, edited 1 time in total.
RE: How do you save variables?
As I remember, ZH just encrypts their CVARs by some algorithm which was hacked later :(
Last edited by ZzZombo on Tue Jun 26, 2012 11:54 am, edited 1 time in total.
-
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
RE: How do you save variables?
okay i'm back
also, listacs
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
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?Catastrophe wrote: Anyway to hide scripts? At least from an idiot that just lazily opened up slade?
also, listacs
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 withCatastrophe wrote: Yep, I want to make it unlockable. How did ZH do it?
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?
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.
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.
-
- Zandrone
- Posts: 1244
- Joined: Thu Jun 28, 2012 9:07 pm
- Location: Rwanda
RE: How do you save variables?
Blue msg me on TS (when you get back), I got a safe way to use StrParam cvar saving safely
Last edited by Watermelon on Fri Jun 29, 2012 5:12 pm, edited 1 time in total.
RE: How do you save variables?
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.
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.
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
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.