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 


here is an ex of what I need

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

Joined: 18 Oct 2014
Posts: 25

PostPosted: Sun Sep 20, 2015 7:43 pm    Post subject: here is an ex of what I need Reply with quote

I need it to read these addresses: 12345678, 23456789 and 34567890 then write those values 09876543, 98765432 and 87654321

to these addresses: 45678901, 56789012 and 67890123 and minus 200 from each at this same time from what the original addresses are.

I need it to always be doing that. If any one can help me I would appreciate it.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Sep 20, 2015 8:51 pm    Post subject: Reply with quote

Code:
local read_from = {
  "12345678",
  "23456789",
  "34567890"
}
local write_to = {
  "45678901",
  "56789012",
  "67890123"
}
for i = 1, #read_from do
  local value = readInteger(read_from[i])
  value = value - 200
  writeInteger(write_to[i], value)
end
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Wed Sep 23, 2015 11:36 am    Post subject: Reply with quote

any way to make it to where

if the first set of address values increases then minus 2000 or
if the addresses values decreases then add 2000?

local read_from = {
"12345678",
"23456789",
"34567890"
}
local write_to = {
"45678901",
"56789012",
"67890123"
}
for i = 1, #read_from do
local value = readInteger(read_from[i])
value = value - 2000
writeInteger(write_to[i], value)
end
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Sep 23, 2015 5:01 pm    Post subject: Reply with quote

I believe this is what you're asking for...
If the value from the second list does not match the value in the first, then add or subtract 2000 at a time until it matches?
Code:
local read_from = {
  "12345678",
  "23456789",
  "34567890"
}
local write_to = {
  "45678901",
  "56789012",
  "67890123"
}
for i = 1, #read_from do
  local value = readInteger(read_from[i])
  local current = readInteger(write_to[i])
  if current > value then
    current = current - 2000
    if current < value then
      current = value
    end
  elseif current < value then
    current = current + 2000
    if current > value then
      current = value
    end
  end
  writeInteger(write_to[i], current)
end
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Wed Sep 23, 2015 6:36 pm    Post subject: Reply with quote

No I want the 2nd list to match the first

but if the first list values increase
match them and -2000

but if the first list values decrease
match them and +2000

I want it to always be doing that
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Sep 23, 2015 7:46 pm    Post subject: Reply with quote

Okay... this should do it.
Code:
-- initialization
read_from = {
  "12345678",
  "23456789",
  "34567890"
}
write_to = {
  "45678901",
  "56789012",
  "67890123"
}
last_value = {}
locked_value = {}
for i = 1, #read_from do
  local value = readInteger(read_from[i])
  last_value[i] = value
  locked_value[i] = value
end

-- repeated execution
for i = 1, #read_from do
  local value = readInteger(read_from[i])
  if value > last_value[i] then
    last_value[i] = value
    locked_value[i] = value - 2000
  elseif value < last_value[i] then
    last_value[i] = value
    locked_value[i] = value + 2000
  end
  writeInteger(write_to[i], locked_value[i])
end
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Wed Sep 23, 2015 9:30 pm    Post subject: Reply with quote

-- initialization
read_from = {
"12345678",
"23456789",
"34567890"
}
write_to = {
"45678901",
"56789012",
"67890123"
}
last_value = {What do I put in here? }
locked_value = {What do I put in here?}
for i = 1, #read_from do
local value = readInteger(read_from[i])
last_value[i] = value
locked_value[i] = value
end

-- repeated execution
for i = 1, #read_from do
local value = readInteger(read_from[i])
if value > last_value[i] then
last_value[i] = value
locked_value[i] = value - 2000
elseif value < last_value[i] then
last_value[i] = value
locked_value[i] = value + 2000
end
writeInteger(write_to[i], locked_value[i])
end
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Sep 23, 2015 9:48 pm    Post subject: Reply with quote

Nothing. The script populates them and uses them as temporary storage to remember previous values.
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Thu Sep 24, 2015 9:30 am    Post subject: Reply with quote

the code works but it only works once then stops instantly

I added a little spot by the bottom.

Is there anyway to add something like this at the top to activate the part you wrote for me?


valueTwo = readInteger("1315FB90") --Target
valueThree = readInteger("1145340C") --Ability Bar visible
valueFour = readInteger("11453408") --Binding Grasp Slot 1
valueFive = readInteger("1315AA12") --Circle button Pressed

if valueTwo == 553883 and valueThree == 1 and valueFour == 1 and valueFive == 16256 then
-- I want all 4 of the addresses values to be true before your code will work




--an undead mammoth's overhead Name
writeInteger("12875044", 1965059681)
writeInteger("12875048", 1634034798)
writeInteger("1287504C", 1634541668)
writeInteger("12875050", 1953459565)
writeInteger("12875054", 104)
writeInteger("12875058", 0)
--an undead mammoth's Bar
writeInteger("1317F944", 1965059681)
writeInteger("1317F948", 1634034798)
writeInteger("1317F94C", 1634541668)
writeInteger("1317F950", 1953459565)
writeInteger("1317F954", 104)
writeInteger("1317F958", 0)



-- initialization
read_from = {
"1315A6D8",
"1315A6E0",
--"34567890"
}
write_to = {
"12894C00",
"12894C08",
--"67890123"
}
last_value = {}
locked_value = {}
for i = 1, #read_from do
local value = readInteger(read_from[i])
last_value[i] = value
locked_value[i] = value
end

-- repeated execution
for i = 1, #read_from do
local value = readInteger(read_from[i])
if value > last_value[i] then
last_value[i] = value
locked_value[i] = value - 2000
elseif value < last_value[i] then
last_value[i] = value
locked_value[i] = value + 2000
elseif value == last_value[i] then --I added this and it works
last_value[i] = value
locked_value[i] = value + 2000

end
writeInteger(write_to[i], locked_value[i])
end

Also if this addresses
1315A974 value is 1
and this addresses
1315FB90 is 553883 I would like the code to stop but not the script
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Sep 24, 2015 10:57 am    Post subject: Reply with quote

Code:
read_from = {
  "1315A6D8",
  "1315A6E0",
  --"34567890"
}
write_to = {
  "12894C00",
  "12894C08",
  --"67890123"
}
must_equal = {
  ["1315FB90"] = 553883,
  ["1145340C"] = 1,
  ["11453408"] = 1,
  ["1315AA12"] = 16256
}
last_value = {}
locked_value = {}
for i = 1, #read_from do
  local value = readInteger(read_from[i])
  last_value[i] = value
  locked_value[i] = value + 2000
end

function repeated_execution()
  for addr, value in pairs(must_equal) do
    if readInteger(addr) ~= value then
      return
    end
  end
  for i = 1, #read_from do
    local value = readInteger(read_from[i])
    if value > last_value[i] then
      last_value[i] = value
      locked_value[i] = value - 2000
    elseif value < last_value[i] then
      last_value[i] = value
      locked_value[i] = value + 2000
    end
    writeInteger(write_to[i], locked_value[i])
  end
end

if script_timer == nil then
  script_timer = createTimer(nil, false)
  script_timer.Interval = 1000
end
script_timer.OnTimer = repeated_execution
script_timer.Enabled = true
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Thu Sep 24, 2015 6:25 pm    Post subject: Reply with quote

Thank you very much. I really appreciate it
Back to top
View user's profile Send private message
Faxonation
Cheater
Reputation: 0

Joined: 18 Oct 2014
Posts: 25

PostPosted: Fri Sep 25, 2015 2:27 am    Post subject: Reply with quote

You wouldn't know how to make dokeypress(vk_CONTROL and VK_DELETE) work would you?

I have read everything I could find and still nothing will work for me.

Or how to make the lua script hit my Cheat Engine hotkeys for me.

Or how to write this address... then wait 5 seconds and then write this address.. then wait 4 seconds then write this address.. then wait 7 seconds and then write this address.. with out the scripts stopping. I want the script to keep running but I want it to wait that long before running code.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Sep 25, 2015 10:01 pm    Post subject: Reply with quote

Code:
keyDown(VK_CONTROL)
doKeyPress(VK_DELETE)
keyUp(VK_CONTROL)

Code:
actions = {
  {
    ["delay"] = 5000,
    ["func"] = function()
      print("action 1")
    end
  },
  {
    ["delay"] = 4000,
    ["func"] = function()
      print("action 2")
    end
  },
  {
    ["delay"] = 7000,
    ["func"] = function()
      print("action 3")
    end
  },
}
if action_timer == nil then
  action_timer = createTimer(nil, false)
  action_timer.Interval = 1000
end
current_action = 1
action_elapsed = 0
action_timer.OnTimer = function(timer)
  if current_action > #actions then
    current_action = 1
  end
  action_elapsed = action_elapsed + timer.Interval
  if action_elapsed >= actions[current_action].delay then
    actions[current_action].func()
    action_elapsed = 0
    current_action = current_action + 1
  end
end
action_timer.Enabled = true
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