Jump to content

Archived

This topic is now archived and is closed to further replies.

Ziciphy

Scripting Help

Recommended Posts

Im trying to make a script that has 4 options, the first one changes double 0.10 to 10/
second option to change double 2.5 to negative 10/ and 3rd option change double 0.5 to 5 and finally the last one to exit the script, 
Im new to scripting I would really appreciate it if anyone could help me out or give me an example script to look at.

:start:
menu == gg.choice ({Hack1,exit})
if menu == 1 then goto OK1 end
if menu == 2 then goto OK2 end
if menu == 3 then goto OK3 end
if menu == 4 then goto done end
if menu == nil then goto done end
:OK1:
gg.clearResults()
gg.searchNumber(0.10, gg.TYPE_DOUBLE)
gg.getResults(20)
gg.editAll(10, gg.TYPE_DOUBLE)
gg.clearResults()
:OK2:
gg.clearResults()
gg.searchNumber(2.5, gg.TYPE_DOUBLE)
gg.getResults(22)
gg.editAll(-10, gg.TYPE_DOUBLE)
gg.clearResults()
:OK3:
gg.clearResults()
gg.searchNumber(0.5, gg.TYPE_DOUBLE)
gg.getResults(18)
gg.editAll(5, gg.TYPE_DOUBLE)
gg.clearResults()
:done:
os.exit()

Test

Test

Share this post


Link to post
Share on other sites

Replace with this :

function Start()
  local menu = gg.choice({
      '1. Double 0.1 to 10',
      '2. Double 2.5 to -10',
      '3. Double 0.5 to 5',
      '4. Exit'}, nil, 'Select Menu :')
  if menu == 1 then OK1() end
  if menu == 2 then OK2() end
  if menu == 3 then OK3() end
  if menu == 4 then done() end
  if menu == nil then done() end
end
function OK1()
  gg.clearResults()
  gg.searchNumber(0.10, gg.TYPE_DOUBLE)
  gg.getResults(20)
  gg.editAll(10, gg.TYPE_DOUBLE)
  gg.clearResults()
end
function OK2()
  gg.clearResults()
  gg.searchNumber(2.5, gg.TYPE_DOUBLE)
  gg.getResults(22)
  gg.editAll(-10, gg.TYPE_DOUBLE)
  gg.clearResults()
end
function OK3()
  gg.clearResults()
  gg.searchNumber(0.5, gg.TYPE_DOUBLE)
  gg.getResults(18)
  gg.editAll(5, gg.TYPE_DOUBLE)
  gg.clearResults()
end
function done()
  os.exit()
end
Start()

Or if the function is the same, this is a simple script :

function Start()
  local menu = gg.choice({
      '1. Double 0.1 to 10',
      '2. Double 2.5 to -10',
      '3. Double 0.5 to 5',
      '4. Exit'}, nil, 'Select Menu :')
  if menu == 1 then change(0.1, 20, 10) end
  if menu == 2 then change(2.5, 22, -10) end
  if menu == 3 then change(0.5, 18, 5) end
  if not menu or menu == 4 then os.exit() end
end

function change(val, res, edit)
  gg.clearResults()
  gg.searchNumber(val, gg.TYPE_DOUBLE)
  gg.getResults(res)
  gg.editAll(edit, gg.TYPE_DOUBLE)
  gg.clearResults()
  gg.toast('searchNumber: '..val..'\ngetResults: '..res..'\neditAll: '..edit)
end

Start()

 

Share this post


Link to post
Share on other sites

×
×
  • Create New...