Posts: 21
Threads: 8
Joined: Nov 2019
Reputation:
0
12-23-2020, 09:57 AM
(This post was last modified: 12-23-2020, 10:08 AM by Ferumbras699.)
Hello Dude.
this script have a problem, sometimes its work, and sometimes not
He deposit but not transfer.
local PLAYER_DESTINATION = 'player name'
say('hi')
wait(800, 1200)
say('deposit all')
wait(1200, 1800)
say('yes')
wait(1200, 1800)
getnewmessages()
say('balance')
wait(5000)
local msgs = getnewmessages()
for _, msg in ipairs(msgs) do
local gold = tonumber(string.match(msg.content, "Your account balance is (%d+) gold."))
if type(gold) == 'number' and gold > 0 then
say('transfer ' .. gold)
wait(1200, 1800)
say(PLAYER_DESTINATION)
wait(1200, 1800)
say('yes')
wait(1200, 1800)
break
end
end
apparently works the first time and then doesn't
Posts: 2,841
Threads: 459
Joined: Jul 2018
Reputation:
79
12-23-2020, 03:03 PM
(This post was last modified: 12-23-2020, 03:03 PM by Arkilys.)
Hello.
I already used this script for long time and it works just fine.
Just debug adding "print" calls to know where it fails and why.
For example
local PLAYER_DESTINATION = 'player name'
say('hi')
wait(800, 1200)
say('deposit all')
wait(1200, 1800)
say('yes')
wait(1200, 1800)
getnewmessages()
say('balance')
wait(5000)
local msgs = getnewmessages()
print('msgs count:', #msgs)
for _, msg in ipairs(msgs) do
print('msg: ', msg)
local gold = tonumber(string.match(msg.content, "Your account balance is (%d+) gold."))
print('gold : ', gold)
if type(gold) == 'number' and gold > 0 then
print('found msg')
say('transfer ' .. gold)
wait(1200, 1800)
say(PLAYER_DESTINATION)
wait(1200, 1800)
say('yes')
wait(1200, 1800)
break
end
end
print('----')
It will print some stuff on console, just copy and paste the results here or check it yourself. hehe
Posts: 21
Threads: 8
Joined: Nov 2019
Reputation:
0
17:09:40 - msg: {sender = "player", time = "17:09", channel = "Default", fullcontent = "17:09 player: balance", content = "balance", type = 0}
17:09:40 - gold :
17:09:40 - msg: {sender = "Suzy", time = "17:09", channel = "Default", fullcontent = "17:09 Suzy: Your account balance is 2,883 gold.", content = "Your account balance is 2,883 gold.", type = 0}
17:09:40 - gold :
17:09:40 - ----
17:10:01 - msgs count: 2
17:10:01 - msg: {sender = "player", time = "17:09", channel = "Default", fullcontent = "17:09 player: balance", content = "balance", type = 0}
17:10:01 - gold :
17:10:01 - msg: {sender = "Suzy", time = "17:09", channel = "Default", fullcontent = "17:09 Suzy: Your account balance is 2,883 gold.", content = "Your account balance is 2,883 gold.", type = 0}
17:10:01 - gold :
17:10:01 - ----
Posts: 2,841
Threads: 459
Joined: Jul 2018
Reputation:
79
local PLAYER_DESTINATION = 'player name'
say('hi')
wait(800, 1200)
say('deposit all')
wait(1200, 1800)
say('yes')
wait(1200, 1800)
getnewmessages()
say('balance')
wait(5000)
local msgs = getnewmessages()
for _, msg in ipairs(msgs) do
local gold_str = string.match(msg.content, "Your account balance is (%f[%d]%d[,.%d]*%f[%D]) gold."):gsub(",", "")
if gold_str ~= nil and gold_str ~= '' then
local gold = tonumber(gold_str)
if type(gold) == 'number' and gold > 0 then
say('transfer ' .. gold)
wait(1200, 1800)
say(PLAYER_DESTINATION)
wait(1200, 1800)
say('yes')
wait(1200, 1800)
break
end
end
end
Posts: 21
Threads: 8
Joined: Nov 2019
Reputation:
0
Posts: 2,841
Threads: 459
Joined: Jul 2018
Reputation:
79
local PLAYER_DESTINATION = 'player name'
say('hi')
wait(800, 1200)
say('deposit all')
wait(1200, 1800)
say('yes')
wait(1200, 1800)
getnewmessages()
say('balance')
wait(5000)
local msgs = getnewmessages()
for _, msg in ipairs(msgs) do
local gold_str = string.match(msg.content, "Your account balance is (%f[%d]%d[,.%d]*%f[%D]) gold.")
if gold_str ~= nil and gold_str ~= '' then
gold_str = gold_str:gsub(",", "")
if gold_str ~= nil and gold_str ~= '' then
local gold = tonumber(gold_str)
if type(gold) == 'number' and gold > 0 then
say('transfer ' .. gold)
wait(1200, 1800)
say(PLAYER_DESTINATION)
wait(1200, 1800)
say('yes')
wait(1200, 1800)
break
end
end
end
end
Posts: 21
Threads: 8
Joined: Nov 2019
Reputation:
0
It worked, thank you so much! |Only Registered members can see download links. | Click here to buy subscription or here to register.|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Big Grin" title="Big Grin" class="smilie smilie_4" />
|