Jump to content
  • 0

How to write lua script to find & copy game status bin to storage /download


Jamieq
 Share

Question

This is script I wrote but won't read/ open file , need help 

 

local file = io.open("/storage/emulated/0/data/data/files/game_status.bin", "wb")

if file then

    local status = gg.getResults(gg.getResultsCount())

    for i, v in ipairs(status) do

        file:write(string.format("%s\n", v.value))

    end

    file:close()

    gg.toast("Game status saved to Download folder.")

else

    gg.toast("Failed to open file for writing.")

end

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Says can't open game status file

I figured it out but had to write new script, still if anyone knows easy ways to accomplish this fuction  I'll try 

Link to comment
Share on other sites

  • 0

The full script I'm trying to create is a game status bin replacement with modded game status bin in storage,  download ,(for hcr2) 

Link to comment
Share on other sites

  • 0

This 1 worked ,used to see if I can copy game status bin to storage download. I'm having a hard time finding or opening main game status bin (usually), I learn by trial & error or lucky enough to have a lua script with similar functions.

 

local gg = require("gg")

 

local function replaceGameStatus()

    local packageName = "com.fingersoft.hcr2"

    local originalPath = "/data/data/" .. packageName .. "/files/gamestatus.bin"

    local moddedPath = "/storage/emulated/0/Download/gamestatus.bin"

 

    if gg.getFile(originalPath) then

        gg.copyFile(moddedPath, originalPath)

        gg.alert("Game status file replaced successfully!")

    else

        gg.alert("Original game status file not found!")

    end

end

 

replaceGameStatus()

 

Link to comment
Share on other sites

  • 0

Each file has a permission: read, write, executable.
Each folder has permission: read, write, and to view its content.
This is for owner of file and for group owner belongs to.
You won't be able to change this using GG.
Standard lua function os.execute(command), blocked for security reasons.

Link to comment
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
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.