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 


how to add listview of coordinates to my trainer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Oct 11, 2020 5:02 am    Post subject: Reply with quote

Try this as an example Laughing Laughing Laughing

Code:
if golum then golum.destroy() end

golum = createForm()
golum.setSize(420,210)
golum.Position = 'poScreenCenter'
golum.Caption = 'LOL LOTR LOL - MIDDLE EARTH MAP'

Hobbits = createListView(golum)
Hobbits.setPosition(10,10)
Hobbits.setSize(400,150)
Hobbits.BorderSize = 'bsNone'
Hobbits.ViewStyle='vsReport'
Hobbits.GridLines=true
Hobbits.ScrollBars = 'ssAutoVertical'

frodo=Hobbits.Columns.add()
sam=Hobbits.Columns.add()
pipin=Hobbits.Columns.add()
merry=Hobbits.Columns.add()

frodo.Caption="X"
frodo.Width = 80
frodo.Alignment = 'taCenter'
sam.Caption="Y"
sam.Width = 80
sam.Alignment = 'taCenter'
pipin.Caption="Z"
pipin.Width = 80
pipin.Alignment = 'taCenter'
merry.Caption="Location"
merry.Width = 160
merry.Alignment = 'taCenter'

gandalf = createButton(golum)
gandalf.setSize(100,30)
gandalf.setPosition(10,Hobbits.Top + Hobbits.Height + 10)
gandalf.Caption = 'Get To Mordor'

---------------------------------------------------------------------------
mapfile = 'D:\\lotr.txt'

function MiddleEarthLocation()
 Hobbits.Clear()
 local point_file = io.open(mapfile, "r")
 if not point_file then
    showMessage('Map file not found!. Asks Sauron for new map')
    return nil
 else
    showMessage('Updating new map locations from Rivendale')
    for line in point_file:lines() do
      local px, py, pz, ploc = line:match("([^,]+),([^,]+),([^,]+),([^,]+)")
      local items = Hobbits.Items
      local item = items.Add()
            item.Caption = px
            item.SubItems.Add(py)
            item.SubItems.Add(pz)
            item.SubItems.Add(ploc)
    end
 end
end

golum.Show()
gandalf.OnClick = MiddleEarthLocation


NOTE:
Your data inside the text file must be with the following formats:

Code:
2241.630615,-888.9954224,219.1488953,Rohan Land
2244.343455,-434.6535324,119.1324453,Gondor White Palace
3433.111115,-111.1111111,111.1234556,Helm Deep


Be careful with data format structures

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Oct 11, 2020 9:59 am    Post subject: Reply with quote

Ok. I assume you already have the pointer address for your coordinate cheat table. If not then ask to others how to retrieves pointer address value.
I believe there are a module call 'I2Teleporter' created by 'TheyCallMeTim' some where here, use to retrieve player coordinated automatic.

The script below just an complete example about load data from text file, add data from cheat table to list view and save data from list view to a text file.

Note : If you re-answer the topic you must not add quote for every comments or answer. That make the topic too big and long.

Okay, here is the code:

Code:
if golum then golum.destroy() end

golum = createForm()
golum.setSize(420,210)
golum.Position = 'poScreenCenter'
golum.Caption = 'LOL LOTR LOL - MIDDLE EARTH MAP'

Hobbits = createListView(golum)
Hobbits.setPosition(10,10)
Hobbits.setSize(400,150)
Hobbits.BorderSize = 'bsNone'
Hobbits.ViewStyle='vsReport'
Hobbits.GridLines=true
Hobbits.ScrollBars = 'ssAutoVertical'

frodo=Hobbits.Columns.add()
sam=Hobbits.Columns.add()
pipin=Hobbits.Columns.add()
merry=Hobbits.Columns.add()

frodo.Caption="X"
frodo.Width = 80
frodo.Alignment = 'taCenter'
sam.Caption="Y"
sam.Width = 80
sam.Alignment = 'taCenter'
pipin.Caption="Z"
pipin.Width = 80
pipin.Alignment = 'taCenter'
merry.Caption="Location"
merry.Width = 160
merry.Alignment = 'taCenter'

gandalf = createButton(golum)
gandalf.setSize(110,30)
gandalf.setPosition(10,Hobbits.Top + Hobbits.Height + 10)
gandalf.Caption = 'Get Mordor Loc'

aragon = createButton(golum)
aragon.setSize(110,30)
aragon.setPosition(gandalf.Left + gandalf.Width + 5, Hobbits.Top + Hobbits.Height + 10)
aragon.Caption = 'Save Mordor Loc'

msg = [[
Doble click on the list
to add item from cheat table
]]

gimly = createLabel(golum)
gimly.setPosition(260, Hobbits.Top + Hobbits.Height + 10)
gimly.Caption = msg


---------------------------------------------------------------------------
mapfile = 'D:\\lotr.txt'

function MiddleEarthLocation()
 Hobbits.Clear()
 local point_file = io.open(mapfile, "r")
 if not point_file then
    showMessage('Map file not found!. Asks Sauron for new map')
    return nil
 else
    showMessage('Updating new map locations from Rivendale')
    for line in point_file:lines() do
      local px, py, pz, ploc = line:match("([^,]+),([^,]+),([^,]+),([^,]+)")
      local items = Hobbits.Items
      local item = items.Add()
            item.Caption = px
            item.SubItems.Add(py)
            item.SubItems.Add(pz)
            item.SubItems.Add(ploc)
    end
 end
end

function AddItems(sender)
 local cX = getAddressList().getMemoryRecordByDescription("X")
 local cY = getAddressList().getMemoryRecordByDescription("Y")
 local cZ = getAddressList().getMemoryRecordByDescription("Z")
 local loc

 -- get the values
 coordx = cX.Value
 coordy = cY.Value
 coordz = cZ.Value
 loc = 'Unknown'

 -- add to list view
 local items = Hobbits.Items
 local item = items.Add()
 item.Caption = coordx
 item.SubItems.Add(coordy)
 item.SubItems.Add(coordz)
 item.SubItems.Add(loc)
end

function saveHobbitItems()
 local point_file,err = io.open(mapfile,'w')
 if point_file then
   local crX, crY, crZ, loctn, i
   local items = Hobbits.Items
   for i = 0, Hobbits.Items.Count-1 do
       local items = Hobbits.Items
       crX = items[i].Caption
       crY = items[i].SubItems[0]
       crZ = items[i].SubItems[1]
       loctn = items[i].SubItems[2]
       point_file:write(crX..','..crY..','..crZ..','..loctn..'\n')
    end
    point_file:close()
    showMessage("Save success")
  else
    showMessage("Save error:", err)
    return nil
  end
end

golum.Show()
gandalf.OnClick = MiddleEarthLocation
Hobbits.OnDblClick = AddItems
aragon.OnClick = saveHobbitItems

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Oct 11, 2020 10:26 am    Post subject: Reply with quote

zbobfrank90 wrote:
thanks very much. if you accept donations please let me know.

i also did fix the doube click teleportation through


Ah, yes. That to add cheat table from the list items.
Your welcome and thanks for offered.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Oct 12, 2020 2:09 am    Post subject: Reply with quote

zbobfrank90 wrote:
im trying to do the following

- right click a selected row -> showing option of delete -> delete the entry


Delete an item from list. The right order is like this:
- right click a selected row -> showing option of delete -> delete the entry -> RENEW data with save it

so, maybe something like this (add to your script)

Code:
-- at list created
Hobbits.RowSelect = true
Hobbits.ReadOnly = false

-- function to delete an item and re-new data
function deleteHobbitItem(sender, listitem, selected)
  if selected then
     local items = Hobbits.Items
     local idx = Hobbits.ItemIndex
     if selected and isKeyPressed(VK_RBUTTON) == true then
        if messageDialog([[Would you like to travel to the underworld ?]], mtInformation,mbYes, mbNo)==mrYes then
           items[idx].Delete(selected)
           showMessage('Rebuild data')
           saveHobbitItems()
        else
           return nil
        end
     end
  end
end

-- call the function with:
Hobbits.OnSelectItem = deleteHobbitItem


I couldn't make it much better, maybe someone else is possible.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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