YouGroove Posted January 7, 2015 Share Posted January 7, 2015 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. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
MarkusR Posted January 7, 2015 Share Posted January 7, 2015 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 Quote 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 , ... Link to comment Share on other sites More sharing options...
Guppy Posted January 8, 2015 Share Posted January 8, 2015 also http://www.rjek.com/arcfour.lua.txt Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
Recommended Posts
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.