Does this work?
function setNewName()
local t = gg.getResults(gg.getResultsCount())
local replaceString = {}
local stringSize = {}
local str = {}
gg.clearResults()
for i= 1, #editname[1] do
str[i] = string.sub(editname[1], i, j)
end
for i, v in ipairs(t) do
stringSize[#stringSize + 1] = {address = t[i].address - 0x4, flags = gg.TYPE_WORD, value = #editname[1]}
for charCount = 1, #editname[1] do
replaceString[#replaceString + 1] = {address = t[i].address, flags = gg.TYPE_WORD, value = string.byte(string.sub(str[charCount], 1, 1))}
t[i].address = t[i].address + 2
end
end
gg.setValues(replaceString)
gg.setValues(stringSize)
end
function findName()
gg.setRanges(gg.REGION_ANONYMOUS)
gg.searchNumber(';'..playername[1])
local a = gg.getResults(gg.getResultsCount())
if #a == 0 then
gg.toast("name not found, search again")
prompt_search()
else
gg.refineNumber(a[1].value..';'..a[2].value..';'..a[3].value..'::5')
gg.refineNumber(a[1].value)
end
end
-- if menu is nil
function noselect()
gg.toast('You not select anything')
end
function prompt_edit()
editname = gg.prompt(
{[1] = 'Input name to modify to'},
{[1] = '0'},
{[1] = 'text'})
if editname == nil then noselect() else
setNewName()
end
end
function prompt_search()
playername = gg.prompt(
{[1] = 'Input desired player name.'},
{[1] = '0'},
{[1] = 'text'})
if playername == nil then
noselect()
else
findName()
prompt_edit()
end
end
prompt_search()
while (true) do
if gg.isVisible() then
gg.setVisible(false)
prompt_search()
end
gg.sleep(100)
end