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 


Simple Lua ASM script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
CodeKiller
Advanced Cheater
Reputation: 0

Joined: 30 Jun 2009
Posts: 87

PostPosted: Thu Mar 12, 2020 6:37 am    Post subject: Simple Lua ASM script Reply with quote

Hello,

Do you know why the first "IF" does not work ?

Code:
GOLD=inputQuery('Gold address', 'What it the current gold address ?','')

if GOLD then
   local scriptStr = [[
         alloc(GOLD,8)
         registersymbol(GOLD)

   GOLD:
   dq ]] .. GOLD .. [[
   ]]

   if autoAssemble(scriptStr) then
       print('The auto assembler script was successful.')
   else
       print('There was an error with the auto assembler script.')
   end
end


Thanks !
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Thu Mar 12, 2020 8:40 am    Post subject: Reply with quote

define "not working"

if you click cancel the if doesn't go, but if you click ok it does

_________________
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
CodeKiller
Advanced Cheater
Reputation: 0

Joined: 30 Jun 2009
Posts: 87

PostPosted: Thu Mar 12, 2020 8:55 am    Post subject: Reply with quote

I mean if the var is empty it continues and I want to avoid miss click/return.

But yes "Escape" or "Cancel" works as intended.

I found the code I needed in fact. Wink

Sorry for topic, it helps me investigate myself. Razz

Code:
GOLD=inputQuery('Gold address', 'What it the current gold address ?','')

if not GOLD == nil or not GOLD == '' then
   local scriptStr = [[
         alloc(GOLD,8)
         registersymbol(GOLD)

   GOLD:
   dq ]] .. GOLD .. [[
   ]]

   if autoAssemble(scriptStr) then
       print('The auto assembler script was successful.')
   else
       print('There was an error with the auto assembler script.')
   end
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Thu Mar 12, 2020 9:10 am    Post subject: Reply with quote

you can rewrite
Code:

if not GOLD == nil or not GOLD == '' then

into
Code:

if gold and gold~='' then

_________________
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
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