write text to local file with maniascript

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

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

write text to local file with maniascript

Post by crimplene » 18 Mar 2018, 16:56

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: 1288
Joined: 13 Jun 2014, 08:43
Location: Slovakia // Slovensko
Contact:

Re: write text to local file with maniascript

Post by adamkooo2 » 18 Mar 2018, 18:21

I would like to know that too :)
/\rkady
Image

crimplene
Posts: 19
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene » 18 Mar 2018, 18:46

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: 1205
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: write text to local file with maniascript

Post by Miss » 18 Mar 2018, 23:08

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".
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative Maniaplanet scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

crimplene
Posts: 19
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene » 19 Mar 2018, 09:13

Problem is, I need to persist the data.

User avatar
Miss
Posts: 1205
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: write text to local file with maniascript

Post by Miss » 19 Mar 2018, 09:57

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;
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative Maniaplanet scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

crimplene
Posts: 19
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene » 19 Mar 2018, 11:49

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: 1322
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: write text to local file with maniascript

Post by oliverde8 » 19 Mar 2018, 19:24

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: 19
Joined: 09 May 2017, 17:35

Re: write text to local file with maniascript

Post by crimplene » 19 Mar 2018, 20:15

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... :-)

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest