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 


Change Value of a Script & Edit it

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
FIRESKY
Newbie cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 16

PostPosted: Mon Aug 07, 2017 9:13 am    Post subject: Reply with quote

No one really knows how to solve this problem?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Mon Aug 07, 2017 12:04 pm    Post subject: Reply with quote

script1.Value=CETrainer.CEEdit1.Text

assuming your trainer's Name property is CETrainer and the edit's Name property is CEEdit1

_________________
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
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Aug 07, 2017 7:27 pm    Post subject: Reply with quote

In the changed code you no longer get a reference to the memory record you want to change, so CE has no idea what you're trying to change (the memory record provides the address, the type, etc). It's equivalent to saying *magic reference to what I care about* = "what I want" and praying it'll work.

Try printing the values

Code:
function CEButton1Click(sender)
  --local script1= addresslist_getMemoryRecordByDescription(getAddressList(), "Exp2")
  -- ^ is older syntax the newer version would be
  local script1 = getAddressList().getMemoryRecordByDescription("Exp2")
  if not script1 then
    print('Failed to find the script!')
    return
  end
  print('Value before is: " .. script1.Value)
  script1.Value = CETrainer.CEEdit1.Text
  print('Value after is: " .. script1.Value)
end
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Aug 07, 2017 9:48 pm    Post subject: Reply with quote

You don't put in anything for the print statements, they are written exactly as they should be in the code... except that I seem to have used a single quote to start the string and then tried to use a double quote to end it Embarassed , and then copy pasted lol

make the quotes match (use two single quotes or two double quotes, not one of each). That's what I get for not testing even this short (and fairly simple) code Rolling Eyes

The point is to print the same value the memory record shows in CE, so you have to pass that value to print (in this case I "concatenated" aka appended or added it to a string so that you know without looking at the code to see the order of the print statements which value is which when you see it printed, helpful with larger scripts with more values).

Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Aug 07, 2017 10:47 pm    Post subject: Reply with quote

nearly there Smile

Code:
print("Value before is: script1.Value")

has script1.Value as part of the literal string so that's what gets printed, but you need lua to understand that you want it to use script1 as a variable and to get the Value property from it so it needs to be written like this

Code:
print("Value before is: " .. script1.Value)

... I think print can take multiple values in lua so you can probably also do this:
Code:
print("Value before is:", script1.Value)


but the concatenation allows you to build up a string in a variable pieces at a time and then print it out when you're done so that's what I'm used to doing.
Back to top
View user's profile Send private message
FIRESKY
Newbie cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 16

PostPosted: Wed Aug 09, 2017 11:45 pm    Post subject: Reply with quote

I found another way to succeed in what I wanted
Thank you anyway to all those who have come out to help me
I thank the cheat engine community
Tx Too FreeER,
Even if it was not exactly what I wanted, we got better in PM

SOLVED!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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