View previous topic :: View next topic |
Author |
Message |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Sun Sep 20, 2015 7:43 pm Post subject: here is an ex of what I need |
|
|
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 |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Sep 20, 2015 8:51 pm Post subject: |
|
|
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 |
|
 |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Wed Sep 23, 2015 11:36 am Post subject: |
|
|
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 |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Sep 23, 2015 5:01 pm Post subject: |
|
|
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 |
|
 |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Wed Sep 23, 2015 6:36 pm Post subject: |
|
|
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 |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Sep 23, 2015 7:46 pm Post subject: |
|
|
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 |
|
 |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Wed Sep 23, 2015 9:30 pm Post subject: |
|
|
-- 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 |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Sep 23, 2015 9:48 pm Post subject: |
|
|
Nothing. The script populates them and uses them as temporary storage to remember previous values. |
|
Back to top |
|
 |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Thu Sep 24, 2015 9:30 am Post subject: |
|
|
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 |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Sep 24, 2015 10:57 am Post subject: |
|
|
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 |
|
 |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Thu Sep 24, 2015 6:25 pm Post subject: |
|
|
Thank you very much. I really appreciate it |
|
Back to top |
|
 |
Faxonation Cheater
Reputation: 0
Joined: 18 Oct 2014 Posts: 25
|
Posted: Fri Sep 25, 2015 2:27 am Post subject: |
|
|
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 |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Sep 25, 2015 10:01 pm Post subject: |
|
|
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 |
|
 |
|