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 


Groupscan command in lua?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sat Feb 01, 2014 8:55 am    Post subject: Groupscan command in lua? Reply with quote

Hello there, I want to make scout for manager game like football manager. There are about 4000 players in every save file. I want to list all of them at once.

I want to make a lua script searching 1 byte values in succession (1 alignment)
The groupscan command with cheat engine is :

Code:
BA:1 1:191 1:80 1:125 1:138



These 4 values are present at the start of every player's record in memory regions. So searching these values gives the total number of players.

I want to return the number of results in an edit box like this :
no of results found : "xxxx"


it will be around 4000 results in my game (I get around 4132 to 4145 results in different save files of the game when i make group scan through cheat engine's own groupscan function)

Also one listbox below listing the name of all players (all 4000)
Name of the player can be located by applying an offset to the to the 4 values above. Like search the 4 values apply offset to the first value i.e 191 and then list all names togeher in a listbox for every result found.

Thanks Smile

The values are fixed, we know the expected number of results that the scan should return. Im not able to make a script.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25298
Location: The netherlands

PostPosted: Sat Feb 01, 2014 11:07 am    Post subject: Reply with quote

something like this should work
Code:

ms=createMemScan()
ms.FirstScan(soExactValue, vtGrouped, rtRounded, "BA:1 1:191 1:80 1:125 1:138","", 0, 0xffffffffffffffff,"", fsmNotAligned,"1", false, false, false, false)
ms.waitTillDone()

fl=createFoundList(ms)
for i=0, fl.Count-1 do
  print("0x"..fl.Address[i])
end

fl.destroy()
ms.destroy()

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sat Feb 01, 2014 11:24 am    Post subject: Reply with quote

not returning anything. though it seems that its searching the values as pc slows down for some seconds after clicking on execute.

This also not returning any results? Whole script :

Code:
MS=createMemScan()
FL = createFoundList(MS)
MS.FirstScan(soExactValue, vtGrouped, rtRounded, "BA:1 1:191 1:80 1:125 1:138","", 0, 0xffffffffffffffff,"", fsmNotAligned,"1", false, false, false, false)
results = {}
MS.waitTillDone(); FL.initialize()

FL=createFoundList(MS)
if FL.Count~=0 then
    for i=0,FL.Count-1 do
      local addr = ( "0x"..FL.Address[i] )
      results[#results+1] = addr
    end
  end

  sleep(100); FL.destroy()
  sleep(100); MS.destroy()

return results


any mistake in this?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25298
Location: The netherlands

PostPosted: Sat Feb 01, 2014 11:56 am    Post subject: Reply with quote

you need to call FL.initialize() on the foundlist you're using (i forgot that in my example)

so get rid of that second FL=createFoundList(MS) line (which creates a new one overwriting the active list)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sat Feb 01, 2014 12:19 pm    Post subject: Reply with quote

Not displaying anything still
Im using cheatengine 6.3 r2314

Full script :

Code:

MS=createMemScan()
FL = createFoundList(MS)
MS.FirstScan(soExactValue, vtGrouped, rtRounded, "BA:1 1:191 1:80 1:125 1:138","", 0, 0xffffffffffffffff,"", fsmNotAligned,"1", false, false, false, false)
results = {}
MS.waitTillDone(); FL.initialize()
if FL.Count~=0 then
    for i=0,FL.Count-1 do
      local addr = ( "0x"..FL.Address[i] )
      results[#results+1] = addr
    end
  end

  sleep(100); FL.destroy()
  sleep(100); MS.destroy()

return results

Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25298
Location: The netherlands

PostPosted: Sat Feb 01, 2014 12:24 pm    Post subject: Reply with quote

What is FL.Count?

And what do you do with results? return results in lua engine will just say it's a table, not the content

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sat Feb 01, 2014 12:32 pm    Post subject: Almost there! Reply with quote

Ok i edited my whole post because i have made a lot of changes to the script i earlier posted. Have a listview box that correctly displays the searched addresses in one column and the number of address in another column.
Working like a charm.

Now i just need to apply offsets to the addresses to list player info like "Name" "Surname" in separate columns.

Also add a proggressbar object till the start of search and end of it.

How do i apply offsets to the addresses? Almost there.

EDIT : OK, have attached more images. for easy explanation of what i want to achieve. One image is the screenshot of player's data structure.
2nd image is the resulf of what i get after executing the script of CE.






fmgeniescout.jpg
 Description:
this is a sample screenshot of what i want to achieve. i.e. List all players at once.
 Filesize:  285.01 KB
 Viewed:  15865 Time(s)

fmgeniescout.jpg



Cricket2013 - Scout.CT
 Description:
Latest script. Please tell me how to apply offset to the addresses found.

Download
 Filename:  Cricket2013 - Scout.CT
 Filesize:  1.37 KB
 Downloaded:  881 Time(s)

Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Feb 18, 2014 10:54 am    Post subject: Reply with quote

OK, now I have some time.

Take any player, and give me addresses of all things (from that player) you want to be present in the list.

I will calculate all offsets.


For example, I see at address:
- 150435d7 there is 191 80 125 138 thing
- 150435ec there is DOB
- 150435f4 there is Nationality

Give more addresses

_________________
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Feb 22, 2014 7:33 pm    Post subject: Reply with quote

Well, my "Cricket Captain 2013" trial ended, so I had to find registry entries and hidden files to reset that "few days trial" thing from elicense.

Indeed, there are 4031 players. I added simple filtering option (pattern match, you can try "mmad" Cool )

Latest custom builds of CheatEngine:
https://drive.google.com/folderview?id=0BwMAnE6mjogMNXNjdHgxY1NqcEU&usp=sharing

Anyway, here you can check this unfinished script:
(it can only read few fields, and no save option for now)
Code:
getAutoAttachList().add('Cricket2013.exe')

offsets = {
           StructStart    = 0x000,
           PlayerName     = 0x068, -- pointer
           PlayerSurname  = 0x06C, -- pointer
           DOB            = 0x014, -- 4bytes
           Nationality    = 0x01C, -- 4bytes (use Lua tables)

           ContractTerm   = 0x028, -- 4bytes (use Lua tables)
           ContractSalary = 0x02C, -- 4bytes

           BatPreferences = 0x080, -- 4bytes (use Lua tables)
           BatHandWK      = 0x091, -- 4bytes (use Lua tables)
           BatAbility     = 0x095, -- 2bytes
           BowlAbility    = 0xB8D, -- 2bytes
           BowlType       = 0xB90, -- 4bytes (use Lua tables)

           Retirement     = 0x09B, -- 4bytes (use Lua tables)

           PlayerType     = 0x0AC, -- 4bytes (use Lua tables)
           Injury         = 0x0B8, -- 4bytes
          }

playerStructStart = "[[[Cricket2013.exe+005D4D20]+c8]+b0]"

-- other global variables:
results = {}
ChosenPlayer = nil


function num2HEX(num)
  return string.format('%X',num)
end

function easyReading(address)
  local T = {}
  for k,v in pairs(offsets) do
    T[k]=v+address
  end
  return T
end


function customScan()
  local results = {} -- will contain found addresses (every address as string)

  local ID= readInteger(playerStructStart)
  local check1 = readString(  readInteger(playerStructStart..'+'..num2HEX(offsets.PlayerName))  )
  local check2 = readString(  readInteger(playerStructStart..'+'..num2HEX(offsets.PlayerSurname))  )

  if ID==nil or ID==0 or check1==nil or check2==nil then return results end
  local value = num2HEX(ID)

  local MS = createMemScan()
  local FL = createFoundList(MS)

  -- firstScan(scanoption, vartype, roundingtype, input1, input2,
  --           startAddress, stopAddress, protectionflags,
  --           alignmenttype, "alignmentparam",
  --           isHexadecimalInput, isNotABinaryString, isunicodescan, iscasesensitive)

  --    scanOption: soUnknownValue, soExactValue, soValueBetween, soBiggerThan, soSmallerThan
  --    vartype: vtByte, vtWord, vtDword, vtQword, vtSingle, vtDouble, vtString,
  --             vtByteArray, vtGrouped, vtBinary, vtAll
  --    roundingtype: rtRounded, rtTruncated, rtExtremerounded
  --    alignmenttype: fsmNotAligned, fsmAligned, fsmLastDigits

  MS.firstScan(soExactValue, vtDword, rtTruncated, value, nil,
               "0","7fffffff","+W*X-C",
               fsmAligned,"8",          -- I used 8 byte alignment
               true, false, false, false)
  MS.waitTillDone(); FL.initialize()

  if FL.Count~=0 then
    for i=0,FL.Count-1 do

      local addr = ( "0x"..FL.Address[i] ) + 0
      local tab = easyReading(addr)

      local PlayerName = readString( readInteger(tab.PlayerName) )
      local PlayerSurname = readString( readInteger(tab.PlayerSurname) )

      if PlayerName and PlayerSurname then
        local line = (PlayerName..' '..PlayerSurname):upper()
        if line:match(edtFilter.Text:upper()) then
         results[#results+1] = tab
        end
      end

    end
  end

  sleep(50); FL.destroy()
  sleep(50); MS.destroy()
  return results
end



-- Function for adding items in listview
function addItem(index,NameSurname)
  local newListItem = myListView.Items.add()
  local subItems    = newListItem.getSubItems()

  --newListItem.Caption = index
  subItems.add(index)
  subItems.add(NameSurname)
end

function btnReloadClick(btn)
  btn.Enabled = false

  myListView.Items.clear()
  results = customScan()
  if #results==0 then btn.Enabled = true; return end

  myProgressBar.initProgressBar(0,#results,0)
  myListView.Columns[1].AutoSize = false -- to fasten things
  myListView.Columns[2].AutoSize = false -- to fasten things
  processMessages()

  for index = 1,#results do
    local PlayerName = readString( readInteger(results[index].PlayerName) )
    local PlayerSurname = readString( readInteger(results[index].PlayerSurname) )
    addItem(index,PlayerName..' '..PlayerSurname)
    myProgressBar.Position = index
  end

  myListView.Columns[1].AutoSize = true
  myListView.Columns[2].AutoSize = true
  btn.Enabled = true

end

function myListView_UserSelectedItem(lv)
  if lv.ItemIndex < 0 then return end
  ChosenPlayer = results[lv.ItemIndex+1]
  refresh()
end











-- GUI helper functions
function destroyComponents(f)
  while f.ComponentCount>0 do local o=f.Component[0]
    if o.destroy then o.destroy() end
  end
end

-- Function for adding columns in listview
function addColumn(lv,cap,minW,maxW,W)
  local col=lv.getColumns().add()
  col.Caption=cap
  col.MinWidth=minW; col.MaxWidth=maxW; col.Width=W
end

function BelowSibling(control, sibling, leftSpacing, topSpacing)
  control.Anchors = control.Anchors:gsub(  "]"  ,  ", akTop, akLeft]"  )
  control.BorderSpacing.Left = leftSpacing or 0
  control.BorderSpacing.Top = topSpacing or 0

  control.AnchorSideLeft.Control = sibling
  control.AnchorSideTop.Control = sibling

  control.AnchorSideLeft.Side = 'asrTop'
  if control.Parent == sibling then control.AnchorSideTop.Side = 'asrTop'
  else                              control.AnchorSideTop.Side = 'asrBottom' end
end

function NextToSibling(control, sibling, leftSpacing, topSpacing)
  control.Anchors = control.Anchors:gsub(  "]"  ,  ", akTop, akLeft]"  )
  control.BorderSpacing.Left = leftSpacing or 0
  control.BorderSpacing.Top = topSpacing or 0

  control.AnchorSideLeft.Control = sibling
  control.AnchorSideTop.Control = sibling

  control.AnchorSideTop.Side = 'asrTop'
  if control.Parent == sibling then control.AnchorSideLeft.Side = 'asrTop'
  else                              control.AnchorSideLeft.Side = 'asrBottom' end
end

function NextToSiblingCenter(control, sibling, leftSpacing, topSpacing)
  NextToSibling(control, sibling, leftSpacing, topSpacing)
  control.AnchorSideTop.Side = 'asrCenter'
end

function BottomAnchor(control, sibling, bottomSpacing)
  control.Anchors = control.Anchors:gsub(  "]"  ,  ", akBottom]"  )
  control.BorderSpacing.Bottom = bottomSpacing or 0

  control.AnchorSideBottom.Control = sibling
  if control.Parent == sibling then control.AnchorSideBottom.Side = 'asrBottom'
  else                              control.AnchorSideBottom.Side = 'asrTop' end
end

function RightAnchor(control, sibling, rightSpacing)
  control.Anchors = control.Anchors:gsub(  "]"  ,  ", akRight]"  )
  control.BorderSpacing.Right = rightSpacing or 0

  control.AnchorSideRight.Control = sibling
  if control.Parent == sibling then control.AnchorSideRight.Side = 'asrBottom'
  else                              control.AnchorSideRight.Side = 'asrTop' end
end

function addEasyAnchoringFunctionsToObject(obj)
  obj.BelowSibling = function (sibling, leftSpacing, topSpacing)
                      BelowSibling(obj, sibling, leftSpacing, topSpacing)
                    end

  obj.NextToSibling = function (sibling, leftSpacing, topSpacing)
                       NextToSibling(obj, sibling, leftSpacing, topSpacing)
                     end

  obj.NextToSiblingCenter = function (sibling, leftSpacing, topSpacing)
                       NextToSiblingCenter(obj, sibling, leftSpacing, topSpacing)
                     end

  obj.BottomAnchor = function (sibling, bottomSpacing)
                       BottomAnchor(obj, sibling, bottomSpacing)
                     end

  obj.RightAnchor = function (sibling, rightSpacing)
                       RightAnchor(obj, sibling, rightSpacing)
                     end
end

function createButtonEx(owner) local o=createButton(owner)
  addEasyAnchoringFunctionsToObject(o)
  return o
end

function createLabelEx(owner) local o=createLabel(owner)
  addEasyAnchoringFunctionsToObject(o)
  return o
end

function createEditEx(owner) local o=createEdit(owner)
  addEasyAnchoringFunctionsToObject(o)
  return o
end

function createComboBoxEx(owner) local o=createComboBox(owner)
  addEasyAnchoringFunctionsToObject(o)
  return o
end

function createPanelEx(owner) local o=createPanel(owner)
  addEasyAnchoringFunctionsToObject(o)
  return o
end

function createListViewEx(owner) local o=createListView(owner)
  o.addColumn = function (cap,minW,maxW,W) addColumn(o,cap,minW,maxW,W) end
  addEasyAnchoringFunctionsToObject(o)
  return o
end

function createProgressBarEx(owner) local o=createProgressBar(owner)
  o.initProgressBar = function (a,b,p) o.Min=a; o.Max=b; o.Position = p end
  return o
end




-- INIT GUI
destroyComponents(UDF1)
UDF1.setSize(600,400)

reloadButton=createButtonEx(UDF1)
 reloadButton.setPosition(10,10)
 reloadButton.AutoSize = true
 reloadButton.Caption = 'Reload Players'
 reloadButton.OnClick = btnReloadClick

myListView = createListViewEx(UDF1)
 myListView.ViewStyle = 'vsReport'
 myListView.ReadOnly = true
 myListView.RowSelect = true
 myListView.Width = 250
 myListView.Anchors = '[akRight]'

 myListView.BelowSibling(reloadButton,0,5) -- BelowSibling(sibling, leftSpacing, topSpacing)
 myListView.BottomAnchor(UDF1,40)          -- BottomAnchor(sibling, bottomSpacing)

 myListView.addColumn('', 0, 0, 0) -- addColumn(cap,minW,maxW,W)
 myListView.addColumn('No', 30, 80, 30)
 myListView.addColumn('Player name and surname', 140, 1000, 140)

 myListView.Constraints.MinWidth = 250
 myListView.Constraints.MinHeight = 250

 myListView.OnSelectItem = myListView_UserSelectedItem

lblFilter = createLabelEx(UDF1)
 lblFilter.NextToSibling(reloadButton,5,0)
 lblFilter.Caption = 'must match:'

edtFilter = createEditEx(UDF1)
 edtFilter.NextToSibling(lblFilter,5,-15) -- NextToSibling(control, sibling, leftSpacing, topSpacing)

myProgressBar = createProgressBarEx(UDF1)
 myProgressBar.Align = alBottom
 myProgressBar.initProgressBar(0,0,0)

 UDF1.OnClose = function()
                  destroyComponents(UDF1)
                  return caHide
                end
UDF1.show()

panel = createPanelEx(UDF1)
 panel.NextToSibling(myListView,10,0)
 panel.BottomAnchor(UDF1,40)
 panel.RightAnchor(UDF1,5)










-- functions from previous table
function getControlText(control,b1,b2)
  local number = tonumber(control.Text)
  if number==nil then
    control.Color = 0x9090ff   -- bright Red
    control.Width = control.Width + 1  -- oddly, resizing is better than "repaint"
    control.Width = control.Width - 1  --
    return nil -- not a number, nothing more to do
  else
    control.Color = 0x20000000   -- clDefault
    control.Width = control.Width + 1  -- oddly, .... (see above)
    control.Width = control.Width - 1  --
  end

  if b1 then
    b1,b2 = math.min(b1,b2),math.max(b1,b2)
    if number < b1 or number > b2 then
      control.Color = 0x90ffff   -- bright Yellow
      return nil -- outside boundaries, nothing more to do
    end
  end

  return number+0 -- return number (with +0 we are sure it is type=number)
end

--override CE Lua functions
if oldwriteBytes==nil then oldwriteBytes = writeBytes end
if oldwriteInteger==nil then oldwriteInteger = writeInteger end

function writeBytes(a,v)
  if v~=nil then oldwriteBytes(a,v) end
end

function writeInteger(a,v)
  if v~=nil then oldwriteInteger(a,v) end
end
----------


function readShortint(address)
  local value = readInteger(address)
  if value~=nil then
    return bAnd(0xFFFF, value )
  else
    return nil
  end
end

function writeShortint(a,v)
  if v~=nil then
     oldwriteBytes(a, v%256, v/256)
  end
end

function createMirrorTable(T)
 local Tprin = {}
 for k,v in pairs(T) do
   Tprin[v]=k
 end
 return Tprin
end

-- will fill combobox, items are sorted by key
function fillCombobox(combobox,T)
  if not combobox then return end

  combobox.Items.clear()
  tmp = {}
  for k,v in pairs(T) do tmp[#tmp+1] = {k=k,v=v} end
  table.sort(tmp,function (a,b) return a.k < b.k end)
  for _,v in pairs(tmp) do
    combobox.Items.add(v.v)
  end
end






-- place those controls inside "panel", not Form
lblNation = createLabelEx(panel)
lblNation.Caption = "Nationality"
lblNation.BelowSibling(panel,10,10)

lblPlayerType = createLabelEx(panel)
lblPlayerType.Caption = "Player Type"
lblPlayerType.BelowSibling(lblNation,0,15)

lblBatH = createLabelEx(panel)
lblBatH.Caption = "Bat Hand/WickedKeep"
lblBatH.BelowSibling(lblPlayerType,0,15)

lblContract = createLabelEx(panel)
lblContract.Caption = "Contract Term"
lblContract.BelowSibling(lblBatH,0,15)

lblBowlType = createLabelEx(panel)
lblBowlType.Caption = "Bowling Type"
lblBowlType.BelowSibling(lblContract,0,15)


cNation = createComboBoxEx(panel)
cNation.ReadOnly = true
cNation.NextToSiblingCenter(lblNation,10,0)
cNation.RightAnchor(panel,15)

cPlayerType = createComboBoxEx(panel)
cPlayerType.ReadOnly = true
cPlayerType.NextToSiblingCenter(lblPlayerType,10,0)
cPlayerType.RightAnchor(panel,15)

cBatH = createComboBoxEx(panel)
cBatH.ReadOnly = true
cBatH.NextToSiblingCenter(lblBatH,10,0)
cBatH.RightAnchor(panel,15)

cConT = createComboBoxEx(panel)
cConT.ReadOnly = true
cConT.NextToSiblingCenter(lblContract,10,0)
cConT.RightAnchor(panel,15)

cBowlType = createComboBoxEx(panel)
cBowlType.ReadOnly = true
cBowlType.NextToSiblingCenter(lblBowlType,10,0)
cBowlType.RightAnchor(panel,15)




Nationalities = {
  [43]='Australia',
  [44]='England',
  [45]='India',
  [46]='New Zealand',
  [47]='Pakistan',
  [48]='South Africa',
  [49]='Sri Lanka',
  [50]='West Indies',
  [51]='Bangladesh',
  [52]='Zimbabwe',
  [178]='Australia(K)',
  [179]='New Zealand(K)',
  [180]='South Africa(K)',
  [181]='Zimbabwe(K)'
}
NationalitiesMirror = createMirrorTable(Nationalities)
fillCombobox(cNation,Nationalities)

PlayerTypes = {
  [1]='Batsman',
  [2]='All Rounder',
  [3]='Bowler',
  [4]='Opening All Rounder in one day and t20',
  [8]='Opening Batsman in all formats',
  [12]='Opening All Rounder in all formats',
  [16]='Opening Batsman in one day and t20',
  [24]='Opening Batsman in T20 only',
  [28]='Opening All Rounder in t20 only'
}
PlayerTypesMirror = createMirrorTable(PlayerTypes)
fillCombobox(cPlayerType,PlayerTypes)

BatHs = {
   [1]='Left Hand Batsman',
   [2]='Right Hand Batsman',
   [4]='LHB+WicketKeeper',
   [6]='RHB+WicketKeeper',
   [8]='LHB+Occasional WK',
  [10]='RHB+Occasional WK'
}
BatHsMirror = createMirrorTable(BatHs)
fillCombobox(cBatH,BatHs)

ConTs = {
  [1]='No contract',
  [2]='1 year',
  [3]='2 years',
  [4]='3 years',
  [5]='4 years',
  [6]='5 years',
  [7]='6 years'
}
ConTsMirror = createMirrorTable(ConTs)
fillCombobox(cConT,ConTs)

BowlTypes = {
  [0] ='Slow Left Arm Bowler',
  [4] ='Left Handed LS',
  [8] ='Left Arm Medium',
  [12]='Left Arm Fast Medium',
  [16]='Left Arm Medium Fast',
  [20]='Left Arm Fast',
  [32]='Off Spinner ',
  [36]='Right Handed LS',
  [40]='Right Arm Medium',
  [44]='Right Arm Fast Medium',
  [48]='Right Arm Medium Fast',
  [52]='Right Arm Fast',
}
BowlTypesMirror = createMirrorTable(BowlTypes)
fillCombobox(cBowlType,BowlTypes)

function refresh()
  -- Nationality
  local country = Nationalities[ readInteger(ChosenPlayer.Nationality) ]
  if country then cNation.Text = country else cNation.ItemIndex=-1
  end

  -- Player type
  local PT = PlayerTypes[ readInteger(ChosenPlayer.PlayerType) ]
  if PT then cPlayerType.Text = PT else cPlayerType.ItemIndex=-1
  end

  -- BatH/WK
  local BatHand = BatHs[ readInteger(ChosenPlayer.BatHandWK) ]
  if BatHand then cBatH.Text = BatHand else cBatH.ItemIndex=-1
  end

  -- Contract Term
  local ConTerm = ConTs[ readInteger(ChosenPlayer.ContractTerm) ]
  if ConTerm then cConT.Text = ConTerm else cConT.ItemIndex=-1
  end

  -- Bowling Type
  local BType = readInteger(ChosenPlayer.BowlType)
  if BType then
    local BType2 = bAnd(BType,60)  -- %111100
    cBowlType.Text = BowlTypes[ BType2 ]
  else cBowlType.ItemIndex=-1
  end

end



btw. code between lines 151 and 272, those are functions that helped me to decrease script size.

customScan function is the main function used to find all players. I'm using value which we can find at the beginning of playerStructure. This value is not the same for everyone. So, we have to go to "player profiles", to grab at least one player.



script between lines 48 and 52 - this piece of Lua script checks "pointer" (because [[[Cricket2013.exe+005D4D20]+c8]+b0] will point to something else while not in "player profiles").


line 84 filters out all found entries that don't have name and surname.

line 85 and 86 will do filtering based on "must match" (if "must match" is empty, it will pass all)

GUI creations starts at line 276.


You should continue adding controls (I started at line 416) at line 463.


About font styles, control sizes and etc, we will deal with it at the end.



EDIT:
btw2.

previously we used something like this:
local BatHand = BatHs[ readInteger(BatH) ]

now, it is:
local BatHand = BatHs[ readInteger(ChosenPlayer.BatHandWK) ]


Why BatHandWK instead of old BatH? Look at "offsets" table at the beginning.




and instead of
MyForm.cBatH.Text = BatHand

now it is:
cBatH.Text = BatHand



Cricket Captain 2013 Editor_scanmethod.CT
 Description:

Download
 Filename:  Cricket Captain 2013 Editor_scanmethod.CT
 Filesize:  16.1 KB
 Downloaded:  744 Time(s)


_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sun Feb 23, 2014 1:44 pm    Post subject: Reply with quote

ok. I have attached a .CT file in pm to you. Added batting ability and bowling ability editbox. (Rest we dont need to add controls to edit. Editor will be used to edit in detail) This much controls for editing are enough for scout. Instead I was not even expecting this. You added something unique to it Wink a kind of scout + mini editor combo! And loved the filter thing too. Works perfect! Smile

Can we filter it according to nationality too?

Only thing is i tried to list the BatAbility in separate column in listview but coudnt Sad

The command addItems is only for two columns. How do i add a third column?

Also will it be possible to display Nationality in the the listview as Strings like Australia instead of the codes? We do not need to make it editable. Only read only.

One more thing I want to ask, is it possible to edit Batting Ability of ALL players at the same time? Like I select all players, change batting ability to 2000 and click on save. It makes Batting Ability of all players to 2000 with one click?



Thank you loads mgr.Inz.Player Smile


EDIT : ok, I got how to add columns. Now only the following remain :
1) Sortable columns
2) Nationality Filter

Done : Changing Batting Ability all at once (I got this to work too though not the way I wanted. Like with a button click. But directly inserted two lines in btnReload function you can see it I have made it a comment. Works fine that way)

So now only 2 things left i.e. most important being sortable columns anyway using combox with column names, destroying the list. rebuilding it. Or if clickable columns if available. Anyway. Plus Nationality filter. rest done Smile
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