Jump to content

Recommended Posts

Posted

I don't want players to be able to cheat too easy just modifying a save file using plain text.

So having some Lua functions like

Encode(String Save_Game_text, int key)

Decode(String Save_Game_text, int key)

Would be helpfull.

Stop toying and make games

Posted

until u can try this. i try xor but can not do, don't know if we have a bit class in lua.

if u stay/wrap in the byte range 0-255 u can overlap with a keyword.

the codeblock change some b to UPPER case ^^

 

function Script:Crypt(text)

out=""
b=0
for i =1, text:len() do
b=255-text:byte(i) -- range from 0 to 255
out = out .. string.char(B)
end
return out
end

 

-- MR
function Script:Start()

cam=Camera:Create()

end
--This function will be called after the world is rendered, before the screen is refreshed.
--Use this to perform any 2D drawing you want the entity to display.
function Script:PostRender(context)

context:SetBlendMode(Blend.Alpha)
context:SetColor(1,1,1,1)

local a= "ABCDEFGHIJKLMNOPQRSTUVWXYZ Hello ,. ÄÖÜäöü +- °!§$%&/()[]{}=?@"
context:DrawText(a,0,0)

local b=self:Crypt(a)
context:DrawText(b,0,15)

local c=self:Crypt(B)
context:DrawText(c,0,30)

end

function Script:Crypt(text)

out=""
b=0
for i =1, text:len() do
b=255-text:byte(i) -- range from 0 to 255
out = out .. string.char(B)
end
return out
end

PC : Win 10 Pro 64 Bit , 4x cores ~2 GHz , 8 GB RAM , AMD R7 265

2D : Photoline , Zooner Photo Studio 13 , Art Rage Studio 3.5.4 , Ashampoo Snap 7 , ...

3D : Shade 15 Basic , Carrara 8.5 & DAZ Studio 4.8 , Cheetah 3D 6.3.2 , Via Cad 8

Music : Samplitude Music Studio , Music Creator 7

IDE : Leadwerks Engine 3.x , Unity 5.x , (Unreal 4.8.x) , AGK v2.x , Construct 2 , (Clickteam Fusion 2.5) , ShiVa 1.9 , Game Maker Studio , MS Visual Studio .Net , Android Studio , Monkey , ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...