write text to local file with maniascript

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
crimplene
Posts: 21
Joined: 09 May 2017, 17:35

write text to local file with maniascript

Post by crimplene »

Hi,

strange enough, but I did not find a solution for a simple problem:

I want to write some text (setting, player data or whatever) in a local file with maniascript. Is that even possible? And if yes: how?

Reading from a local file with Http.CreateGet() is easy enough, though.

A short answer containing a very short code snippet wopuld be sufficient. :-)

Thx,

crimplene
User avatar
adamkooo2
Posts: 1371
Joined: 13 Jun 2014, 08:43
Location: Slovakia
Contact:

Re: write text to local file with maniascript

Post by adamkooo2 »

I would like to know that too :)
/\rkady
Image
crimplene
Posts: 21
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene »

No need to make fun of me :-)

A simple "Impossible!" would have been enough. So I have to write some shitty http requests and have to deal with all that asynchronous stuff. A small problem with an overly complex solution...
User avatar
Miss
Posts: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: write text to local file with maniascript

Post by Miss »

To be honest, if all you want to do is store some small amounts of user data for a player, you could do a "declare for".
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
crimplene
Posts: 21
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene »

Problem is, I need to persist the data.
User avatar
Miss
Posts: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: write text to local file with maniascript

Post by Miss »

Yes, you do a declare for with the persistent flag. Here's an example from the Turbo scripts:

Code: Select all

declare persistent Integer[Integer] Pers_SettingsSliders for UserMgr.MainUser;
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
crimplene
Posts: 21
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene »

Very nice solution! I hope the persistent variables are not too limited, since I will have to save like 60 or so local values per player. :-)
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: write text to local file with maniascript

Post by oliverde8 »

It is qulite limited no?

We used to use it to store data for the position of each widget in the controller. But it doesen't work since MP4, we keep seing error message "storage limit reached"
viewtopic.php?f=559&t=40383
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
crimplene
Posts: 21
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene »

That heavily limited? I will find a solution where I only need one or two persistent variables - until hopefully someone arives with a working solution for solo campaigns... :-)
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: write text to local file with maniascript

Post by BigBang1112 »

Can I ask what is the exact limit for a persistent variable?
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest