Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Error attempt to concatenate global

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
suckershake
How do I cheat?
Reputation: 0

Joined: 30 Oct 2013
Posts: 8

PostPosted: Sun Nov 17, 2013 7:21 am    Post subject: Error attempt to concatenate global Reply with quote

Error:[string "Offsets =..."]:23: attempt to concatenate global 'TempResult' (a userdata value)


Code:
Offsets =
{
Offset1 = "XX XX XX XX XX XX",
Offset2 = "XX XX XX XX XX XX",
Offset3 = "XX XX XX XX XX XX"
}


function DECtoHEX(IN)
   if IN<=0 then
      return '0'
   end
   local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
   while IN>0 do
      I=I+1
      IN,D=math.floor(IN/B),math.mod(IN,B)+1
      OUT=string.sub(K,D,D)..OUT
   end
   return OUT
end

function Format(count)
[b]local ReadBytes = readBytes(TempResult..'+count',1,true);[/b]
for _,String in pairs(ReadBytes) do
   local Hex = DECtoHEX(String);
   if Hex:len()==1 then
      Hex = '0' .. Hex;
   end
   ReadBytes[_] = Hex;
end
return ReadBytes
end

for key,value in pairs(Offsets) do
   TempResult=AOBScan(value)
   local Result = (unpack(Format(7))..unpack(Format(6))..unpack(Format(5))..unpack(Format(4)))
   print(key..": 0x"..Result)
end




the Format(7) to Format(4) stuff is to print the offset in the right order. Reversing the Bytes.
(and the ; are there cuz of copypaste)

This is not supposed to be the final version, but I have no clue how to make this error go away.
Go away stupid error!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25818
Location: The netherlands

PostPosted: Sun Nov 17, 2013 9:46 am    Post subject: Reply with quote

AOBScan doesn't return a string, but a Stringlist object instead, or nil if no results.

if results are found, you can access the first string, using TempResult[0]

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
suckershake
How do I cheat?
Reputation: 0

Joined: 30 Oct 2013
Posts: 8

PostPosted: Sun Nov 17, 2013 2:07 pm    Post subject: Reply with quote

... Can't believe how long I've been going at this stuff... I guess that's what happens when you make a stupid mistake and copypaste it all the time Sad

Getting
Error:Failure determining what 002367AB+count means
now though...
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sun Nov 17, 2013 2:10 pm    Post subject: Reply with quote

You put '+count'.
count now represents a string --> error, because c.e can't understand what is count.

Set only the + as string ('+') and leave count as a variable.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
suckershake
How do I cheat?
Reputation: 0

Joined: 30 Oct 2013
Posts: 8

PostPosted: Sun Nov 17, 2013 3:27 pm    Post subject: Reply with quote

Thanks Very Happy Now I can focus on properly learning some lua to optimize that crappy makeshift code.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites