Editing Lua file

Viewed 40

I play Sims Freeplay ans I try to find files ton edit my money ingame. I find a filé named : Cheats.lua ans this is the code inside :

cheatModule = SFP.Get().cheatModule
playerModule = SFP.Get().playerModule
            
function AddXP(amount)
    amount = amount or 10000
    im.log.info('Adding XP: ' .. amount)
    cheatModule:AddXP(amount)
end

function AddSimoleons(amount)
    amount = amount or 10000
    im.log.info('Adding Simoleons: ' .. amount)
    cheatModule:AddSimoleons(amount)
end

function AddLifestylePoints(amount)
    amount = amount or 10000
    im.log.info('Adding Lifestyle Points: ' .. amount)
    cheatModule:AddLifestylePoints(amount)
end

function AddCurrency3(amount)
    amount = amount or 10000
    im.log.info('Adding Currency3: ' .. amount)
    cheatModule:AddCurrency3(amount)
end

function SetXP(amount)
    amount = amount or 10000
    im.log.info('Setting XP to: ' .. amount)
    playerModule.xp = amount
end
      
function SetSimoleons(amount)
    amount = amount or 10000
    im.log.info('Setting Simoleons to: ' .. amount)
    playerModule.simoleons = amount
end

function SetLifestylePoints(amount)
    amount = amount or 10000
    im.log.info('Setting Lifestyle Points to: ' .. amount)
    playerModule.lifestylePoints = amount
end

function SetCurrency3(amount)
    amount = amount or 10000
    im.log.info('Setting Currency3 to: ' .. amount)
    playerModule.currency3 = amount
end  

function SkipFTUE()
    cheatModule:SkipFTUE()
end

function SpawnSim()
    cheatModule:SpawnSim()
end

function KillSim()
    cheatModule:KillSim()
end

function SetUberSim(isUberSim)
    cheatModule:SetUberSim(isUberSim)
end

function GiveAmbitionProgress()
    cheatModule:GiveAmbitionProgress()
end

function RemoveAmbitionProgress()
    cheatModule:RemoveAmbitionProgress()
end

function DoAutonomy()
    cheatModule:DoAutonomy()
end

function SetSimAgeInfant()
    cheatModule:SetSimAgeInfant()
end

function SetSimAgeToddler()
    cheatModule:SetSimAgeToddler()
end

function SetSimAgeTween()
    cheatModule:SetSimAgeTween()
end

function SetSimAgeTeenager()
    cheatModule:SetSimAgeTeenager()
end

function SetSimAgeAdult()
    cheatModule:SetSimAgeAdult()
end

function SetSimAgeSenior()
    cheatModule:SetSimAgeSenior()
end

function SkipFTUE()
    -- cheatModule:SkipFTUE()
    -- TODO: There is an issue calling skipFTUE
end

How can I edit this to change money ?

I have already try to edit this line like this :

function SetSimoleons(10000)
    amount = amount or 10000
    im.log.info('Setting Simoleons to: ' 10000 amount)
    playerModule.simoleons = 10000
end

But when I execute it with the compiler I have this error :

/usr/local/lua-5.3.5/luac53: script.lua:34: or '...' expected near '10000'

I need help please,

Alden Vacker

1 Answers

I'm not sure how you got from

function SetSimoleons(amount)
    amount = amount or 10000
    im.log.info('Setting Simoleons to: ' .. amount)
    playerModule.simoleons = amount
end

to

function SetSimoleons(10000)
    amount = amount or 10000
    im.log.info('Setting Simoleons to: ' 10000 amount)
    playerModule.simoleons = 10000
end

why do you replace .. with 10000? That doesn't make any sense even for a beginner.

.. is the concatenation operator. It is used to append the value of variable amount to the string 'Setting Simoleons to: .

Also you replaced the function parameter name amount with 10000 which also doesn't make sense.

10000 is the default amount of Simoleons if you don't provide an argument to SetSimoleons as in SetSimoleons().

This file strongly suggests that you somehow need to call those functions. Not to alter them. I mean you did not even change the number values. You just messed up the code.

I strongly suggest that you learn some basic Lua befor you continue. Replacing random stuff with other random stuff doesn't yield any good.

Related