Jump to content
YeetMeister

Save as .cfg between restarts of script

Recommended Posts

So im creating a script for FWD Assault

My problem is when i save values to different tables, the other tables just dissapear

Now i want to add values to an existing table, how to do that?

And after that when i close the script i wanted to save the values, with the desired address to a .cfg file and on executing the script it should open the .cfg file

Share this post


Link to post
Share on other sites

Posted (edited)
34 minutes ago, YeetMeister said:

i wanted to save the values, with the desired address to a .cfg file and on executing the script it should open the .cfg file

I dont get this

gg.saveVariable()

local t = {}

t['test1'] = {1, 2, 3, 4}

t['test2'] = 42

t['test3'] = 86.3

t['test4'] = 'weapon'

t[4] = t['test1']

gg.saveVariable(t, '/sdcard/test.lua') -- saved

local var = assert(loadfile('/sdcard/test.lua'))() -- loaded

-- Saving input between script restarts

local configFile = gg.getFile()..'.cfg'

local data = loadfile(configFile)

if data ~= nil then data = data() end

local input = gg.prompt({'Please input something'}, data)

if input == nil then os.exit() end

gg.saveVariable(input, configFile)

 

@Enyby

Edited by YeetMeister
I dunno

Share this post


Link to post
Share on other sites
4 hours ago, YeetMeister said:

I dont get this

gg.saveVariable()

local t = {}

t['test1'] = {1, 2, 3, 4}

t['test2'] = 42

t['test3'] = 86.3

t['test4'] = 'weapon'

t[4] = t['test1']

gg.saveVariable(t, '/sdcard/test.lua') -- saved

local var = assert(loadfile('/sdcard/test.lua'))() -- loaded

-- Saving input between script restarts

local configFile = gg.getFile()..'.cfg'

local data = loadfile(configFile)

if data ~= nil then data = data() end

local input = gg.prompt({'Please input something'}, data)

if input == nil then os.exit() end

gg.saveVariable(input, configFile)

 

@Enyby

local configFile = gg.EXT_CACHE_DIR .. "/" .. gg.getFile():match("[^/]+$") .. ".cfg"
local data = loadfile(configFile)
if data ~= nil then
  data = data()
end
local input = gg.prompt({'Please input something .'},data, {"number"}) -- type here number or text , which you want
gg.saveVariable(input, configFile)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Rastakiwi
      Hack requested by INeedHax.
      Version: 9.3.1
      The game requires permanent internet connexion but all the good stuff isn't server sided (you just can't do speedhack).
      PS: The fame/fans hack is similar to the couple popularity. They are both floats incrementing when gaining popularity. Love's popularity is just after the dword value of love XP in memory.
       
    • By laolw
      Hi everyone,
      I would like to create a script that modifies a value string/text that I have pre-selected,  I mean when i start the script, i want that it does that :
      Find   string/text  '_dead'
      Replace the first 100 results by string/text 'relife'
      Its an example of god mod for a game, and i know that i can search string and replace it with this script : 
      Text (string, HEX, AoB) search/replace (#6a821ivq) But i want to create a script who can search and change this value, without that I have nothing to do, just by running the script.
      So can you help me? Because i think its very easy when you know a little bit coding, but i start yesterday so I am worse than a newbie haha, Thanks.
    • By Reversflux
      Haven't been on in a while.. But anyhow here's a Level Hack for Last Day on Earth: Survival V1.7.7
      Hopefully this video helps beginners.
      My YouTube / Click here to Subscribe!
      My Twitter / Follow
      Here's the video! The 2 codes need are posted below video!
       
       CREDITS: @Anonymous1000
      Anonymous1000 YouTube Channel
      -----------------------------------------
      If this helps you at all, please upvote/like, &/or Subscribe. If it don't, then don't
      Yours,
      @Reversflux
    • By Reversflux
      My YouTube Channel | Subscribe
      My Twitter | TutorialsPCAndroid | @Reversflux | Follow
      ----------------------------------------------------------
      Credits:  @Anonymous1000
      ANONYMOUS 1000 HACKER | YouTube Channel
      -------------------------------------------------------
      Last Day on Earth: Survival - v1.7.3 Updated Crate Hack:
      *I took the video pretty slow, it may be annoying to users used to GG. This is more intended for beginners*
      Thanks Game Guardian Forums! 
      If this helps anyone at all, Upvote/Like/Subscribe! If it don't, then dont!  
      Don't forget to Check out Anonymous 1000 YouTube Channel! 
      _______________________________________________ added 3 minutes later
    • By Reversflux
      Jurassic Survival Infinite Mod
      No Obb/Data Just one click install .apk 
      **I DID NOT CREATE MOD, Credits to respectful creator!**
      Drop a comment, like, & subscribe if you feel like doing so. 
      Download Mod Here
      Mod:
      Magic Split
      Craft Without Resources
      Build base without resources
      Upgrade without resources
      Infinite equipment
      Infinite coins / energy / points
×
×
  • Create New...