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 


Help me finish my listview please
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Thu Feb 14, 2013 9:09 pm    Post subject: Reply with quote

GAWK!!!!!
I added a radiobox to the table last night then did some tweaking to write experience to memory.
In the meatime the function to clear the previous listview continues to work, BUT the build table in the FormShow wouldn't work, just a preesents blank list view. I deleted that function in the code table and everthing seemed normal.
I saved the table as cetrainer, and I guess I selected don't allow any changes, because now when it opens the table disappears, the cheat panel is still visible. I changed in the extension in hopes of "seeing" the table again and that failed. Is the table lost forever? Or can I get it back?

Secondly most of the games I play have large value numbers stored in a 3 byte array, I worked out a solution to fill in the larger numbers into the correct locations, but that got me to thinking.
Is there a way to write to the 3 bytes in one step or does it takes 2(my solution) or 3 to get those larger values into memory?

Please get me out of this fix DarkByte(the table that is)
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Feb 16, 2013 8:19 am    Post subject: Reply with quote

pm me the table and I'll see if I can extract the script
_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Feb 16, 2013 8:34 am    Post subject: Reply with quote

I can extract it for you as well. As DB said, post it up on here.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sat Feb 16, 2013 10:53 am    Post subject: Reply with quote

Tell me the secret, please. But here it is.


pSX_FF6(3)_62.CETRAINER
 Description:

Download
 Filename:  pSX_FF6(3)_62.CETRAINER
 Filesize:  16.78 KB
 Downloaded:  512 Time(s)

Back to top
View user's profile Send private message Yahoo Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Feb 16, 2013 11:41 am    Post subject: Reply with quote

Here you go:
http://www.privatepaste.com/ca4491eb0b/rw4tyehtgb

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sat Feb 16, 2013 12:10 pm    Post subject: Reply with quote

Thanks, how do you get those code lines into a table or the original table?
Back to top
View user's profile Send private message Yahoo Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Feb 16, 2013 12:12 pm    Post subject: Reply with quote

bknight2602 wrote:
Thanks, how do you get those code lines into a table or the original table?


I wrote a tool that lets me dump compiled trainer files for Cheat Engine 5.x/6.x including protected .CETRAINER files. It's private due to Dark Bytes request though.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sat Feb 16, 2013 12:25 pm    Post subject: Reply with quote

If the code is bi-directional, could you export to new table and pass it to me?
Back to top
View user's profile Send private message Yahoo Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Feb 16, 2013 8:31 pm    Post subject: Reply with quote

bknight2602 wrote:
If the code is bi-directional, could you export to new table and pass it to me?


Not sure what you mean with this.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sat Feb 16, 2013 10:41 pm    Post subject: Reply with quote

Luckily the response didn't go through, as I have others questions and the forum doesn't allow back to back posts.
Anyway, what I meant was to use the program (or similar program) to put the code lines back into a blank table.

Another question came up concerning listviews.
I have a table that contains 3 listviews on top of one another. What I am trying:
1. Hide the listviews
2. Put values into the list views
3. Show a listview when a radiogroup button is pushed
4. Change the selected hero exp from what's in the listview.
So far
Code:

form_hide(CheatPanel_CEListView1)
form_hide(CheatPanel_CEListView2)
form_hide(CheatPanel_CEListView3)

function addLevelItem1(level, exp)
local lvitems1=listview_getItems(CheatPanel_CEListView1)
Stack overflow here
Code:

local item1=listitems_add(lvitems1)
local subitems1=listitem_getSubItems(item1)
listitem_setCaption(item1,level)
strings_add(subitems1, exp)
addLevelItem1(1, 11)
addLevelItem1(2, 31)
addLevelItem1(3, 71)
addLevelItem1(4, 139)
...
addLevelItem1(35, 409999)
end

function addLevelItem2(level, exp)
local lvitems2=listview_getItems(CheatPanel_CEListView2)
local item2=listitems_add(lvitems2)
local subitems2=listitem_getSubItems(item2)
listitem_setCaption(item2,level)
strings_add(subitems2, exp)
addLevelItem2(1, 23)
addLevelItem2(2, 59)
addLevelItem2(3, 109)
...
addLevelItem2(35, 519999)
end

function addLevelItem3(level, exp)
local lvitems3=listview_getItems(CheatPanel_CEListView3)
local item3=listitems_add(lvitems3)
local subitems3=listitem_getSubItems(item3)
listitem_setCaption(item3,level)
strings_add(subitems3, exp)
addLevelItem3(1, 99)
addLevelItem3(2, 299)
addLevelItem3(3, 599)
...
addLevelItem3(30, 539999)
end

addLevelItem1(level, exp)
addLevelItem2(level, exp)
addLevelItem3(level, exp)
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Mon Feb 18, 2013 10:50 am    Post subject: Reply with quote

Fixed the problem with stack overflow by commenting out all three form_hide statements. There is another problem with the listview(only looked at the first). The code puts in 20029 items into the listview. I'm attaching all the code (no snipping, sorry for the length). The code:
1. Recalculates the table with no errors
2. The exp updating routine(CheatPanel_CEListView1) gives an access error
3. 20029 items put into the list

Code:

function FormActivate(sender)
--listview_clear(CheatPanel_CEListView1)
--listview_clear(CheatPanel_CEListView2)
--listview_clear(CheatPanel_CEListView3)
--print("list views cleared")
end

--function FormShow(sender)
--listview_clear(CheatPanel_CEListView1)
--listview_clear(CheatPanel_CEListView2)
--listview_clear(CheatPanel_CEListView3)
--print("list views cleared")
--end
--form_hide(CheatPanel_CEListView1)
--form_hide(CheatPanel_CEListView2)
--form_hide(CheatPanel_CEListView3)
function addLevelItem1(level, exp)
--listview_clear(CheatPanel_CEListView1)

If the above statement is un-commented only the last item (Level 35 409999) is added to the list. With the statement commented out 20029 items (19995 Level 1 11)are added to the list.
Code:

local lvitems1=listview_getItems(CheatPanel_CEListView1)
local item1=listitems_add(lvitems1)
local subitems1=listitem_getSubItems(item1)
listitem_setCaption(item1,level)
strings_add(subitems1, exp)
end
addLevelItem1(1, 11)
addLevelItem1(2, 31)
addLevelItem1(3, 71)
addLevelItem1(4, 139)
addLevelItem1(5, 279)
addLevelItem1(6, 559)
addLevelItem1(7, 999)
addLevelItem1(8, 1799)
addLevelItem1(9, 2799)
addLevelItem1(10, 3899)
addLevelItem1(11, 5299)
addLevelItem1(12, 7599)
addLevelItem1(13, 9999)
addLevelItem1(14, 12999)
addLevelItem1(15, 16999)
addLevelItem1(16, 20999)
addLevelItem1(17, 25999)
addLevelItem1(18, 31999)
addLevelItem1(19, 39999)
addLevelItem1(20, 49999)
addLevelItem1(21, 61999)
addLevelItem1(22, 74999)
addLevelItem1(23, 89999)
addLevelItem1(24, 106999)
addLevelItem1(25, 126999)
addLevelItem1(26, 149999)
addLevelItem1(27, 174999)
addLevelItem1(28, 199999)
addLevelItem1(29, 229999)
addLevelItem1(30, 259999)
addLevelItem1(31, 289999)
addLevelItem1(32, 319999)
addLevelItem1(33, 349999)
addLevelItem1(34, 379999)
addLevelItem1(35, 409999)
print("list view items added")
--end

function addLevelItem2(level, exp)
--listview_clear(CheatPanel_CEListView2)
local lvitems2=listview_getItems(CheatPanel_CEListView2)
local item2=listitems_add(lvitems2)
local subitems2=listitem_getSubItems(item2)
listitem_setCaption(item2,level)
strings_add(subitems2, exp)
end
addLevelItem2(1, 23)
addLevelItem2(2, 59)
addLevelItem2(3, 109)
addLevelItem2(4, 199)
addLevelItem2(5, 379)
addLevelItem2(6, 699)
addLevelItem2(7, 1299)
addLevelItem2(8, 2399)
addLevelItem2(9, 3999)
addLevelItem2(10, 5999)
addLevelItem2(11, 8199)
addLevelItem2(12, 10999)
addLevelItem2(13, 14999)
addLevelItem2(14, 18999)
addLevelItem2(15, 23999)
addLevelItem2(16, 29999)
addLevelItem2(17, 36999)
addLevelItem2(18, 45999)
addLevelItem2(19, 56999)
addLevelItem2(20, 69999)
addLevelItem2(21, 84999)
addLevelItem2(22, 99999)
addLevelItem2(23, 115999)
addLevelItem2(24, 133999)
addLevelItem2(25, 155999)
addLevelItem2(26, 181999)
addLevelItem2(27, 209999)
addLevelItem2(28, 239999)
addLevelItem2(29, 279999)
addLevelItem2(30, 309999)
addLevelItem2(31, 339999)
addLevelItem2(32, 379999)
addLevelItem2(33, 429999)
addLevelItem2(34, 479999)
addLevelItem2(35, 519999)
--end

function addLevelItem3(level, exp)
--listview_clear(CheatPanel_CEListView3)
local lvitems3=listview_getItems(CheatPanel_CEListView3)
local item3=listitems_add(lvitems3)
local subitems3=listitem_getSubItems(item3)
listitem_setCaption(item3,level)
strings_add(subitems3, exp)
end
addLevelItem3(1, 99)
addLevelItem3(2, 299)
addLevelItem3(3, 599)
addLevelItem3(4, 1199)
addLevelItem3(5, 2399)
addLevelItem3(6, 4199)
addLevelItem3(7, 6399)
addLevelItem3(8, 8999)
addLevelItem3(9, 11999)
addLevelItem3(10, 15999)
addLevelItem3(11, 19999)
addLevelItem3(12, 24999)
addLevelItem3(13, 30999)
addLevelItem3(14, 38999)
addLevelItem3(15, 49999)
addLevelItem3(16, 64999)
addLevelItem3(17, 82999)
addLevelItem3(18, 102999)
addLevelItem3(19, 124999)
addLevelItem3(20, 149999)
addLevelItem3(21, 179999)
addLevelItem3(22, 219999)
addLevelItem3(23, 269999)
addLevelItem3(24, 299999)
addLevelItem3(25, 329999)
addLevelItem3(26, 359999)
addLevelItem3(27, 399999)
addLevelItem3(28, 449999)
addLevelItem3(29, 474463)
addLevelItem3(30, 539999)
--end

--addLevelItem1(level, exp)
--addLevelItem2(level, exp)
--addLevelItem3(level, exp)

function CEButton1Click(sender)
expvalue = tonumber(control_getCaption(CheatPanel_CEEdit1))
--print('Experience = '..expvalue)
if expvalue ~= nil and goldvalue ~= nil and heroname ~= nil then
RecalculateAddresses()
end
end

function CEButton2Click(sender)
goldvalue = tonumber(control_getCaption(CheatPanel_CEEdit2))
--print('Gold = '..goldvalue)
if expvalue ~= nil and goldvalue ~= nil and heroname ~= nil then
RecalculateAddresses()
end
end

function CERadioGroup1Click(sender)
--print("Index ", radiogroup_getItemIndex(CheatPanel_CERadioGroup1))
indexname = radiogroup_getItemIndex(CheatPanel_CERadioGroup1)
h = radiogroup_getItems(CheatPanel_CERadioGroup1)
heroname = strings_getString(h, indexname)
--print(heroname)
if expvalue ~= nil and goldvalue ~= nil and heroname ~= nil then
RecalculateAddresses()
end
end

function RecalculateAddresses()
--print("Hero name ", heroname, "experience to search = " ,expvalue, "and gold to match = ", goldvalue)
  if heroname == "Hero 1" then
      goldoffset = 0xF--items are in num format
      form_show(CheatPanel_CEListView1)
    elseif heroname == "Hero 2" then
      goldoffset = 0x21--items are in num format
      form_show(CheatPanel_CEListView2)
    else
      goldoffset = 0x33--items are in num format
      form_show(CheatPanel_CEListView3)
  end
  --print(goldoffset)
errorOnLookupFailure(false);
ms = createMemScan();
ms2 = createMemScan();
--The key to recalculating should be goldoffset subtracted from a specific hero experience address
memscan_firstScan(ms, soExactValue, vtWord, rtRounded, expvalue, "", "00000000", "7fffffff", "+W*X-C", fsmNotAligned, "", false, false, false, false);
memscan_waitTillDone(ms);
fl = createFoundList(ms);
foundlist_initialize(fl);
foundlist_getCount(fl);
memscan_firstScan(ms2, soExactValue, vtWord, rtRounded, goldvalue, "", "00000000", "7fffffff", "+W*X-C", fsmNotAligned, "", false, false, false, false);
memscan_waitTillDone(ms2);
fl2 = createFoundList(ms2);
foundlist_initialize(fl2);
foundlist_getCount(fl2);
--print("num of search hits for experience is ", foundlist_getCount(fl));
--print("num of search hits for gold is ", foundlist_getCount(fl2));
--print("Gold offset from if statement", goldoffset);
  for x = 0, foundlist_getCount(fl)-1  do--Items are in the hex format (0125D60F) without 0x
    memrec1 = foundlist_getAddress(fl, x);
    memrec2 = tonumber(memrec1, 16);
    --print("Experience from foundlist_getAddress(fl, x)", x, memrec1);
    for y = 0, foundlist_getCount(fl2)-1 do--Items are in hex format without the 0x
      memrec3 = foundlist_getAddress(fl2, y);
      memrec4 = tonumber(memrec3, 16);
      --print("Gold from foundlist_getAddress(fl2, x)", y, memrec3);
      if memrec2 - memrec4 == goldoffset then
        experienceaddress = memrec1;--address in hex format without 0x
        --print("exp address ", experienceaddress);
        goldaddress = memrec3;--address in hex format without 0x
        byteoffset = memrec3--goldaddress
        byteoffset = "0x" .. byteoffset;
        --print("gold address ", goldaddress);
        --print("byteoffset ", byteoffset);
        break;
      end;
    end;
    if byteoffset ~= nil then
      break;
    end;
  end;
local addresslist = getAddressList();
memrec5 = addresslist_getMemoryRecordByDescription(addresslist, "Gold (2 bytes)");--address in hex format without 0x
goldtableaddress = memoryrecord_getAddress(memrec5);--Item in num format
--print("Gold table address", goldtableaddress);
--print("Gold current table address", string.format('%x', goldtableaddress), "which is ", goldtableaddress);
goldtableaddress = string.format('%x', goldtableaddress);--Items in number format converted to hex format without 0x
goldtableaddress = "0x" .. goldtableaddress
for x = 0, addresslist_getCount(addresslist)-1 do
memrec6 = addresslist_getMemoryRecord(addresslist, x);--Item in hex format without the 0x
  if byteoffset ~= goldtableaddress then
    memoryrecord_setAddress(memrec6, string.format('%x', memoryrecord_getAddress(memrec6) + byteoffset - goldtableaddress));
  end;
end;
expvalue = nil
goldvalue = nil
heroname = nil
edit_clear(CheatPanel_CEEdit1);
edit_clear(CheatPanel_CEEdit2);
print("table is recalculated");
--radiogroup_setItemIndex(CheatPanel_CERadioGroup1, -1)
end

function CEListView1Click(sender)
print('Selected index for list 1 = '..listview_getItemIndex(CheatPanel_CEListView1))
indexname1 = listview_getItemIndex(CheatPanel_CEListView1)
e1 = listview_getItems(CheatPanel_CEListView1)
item1 = listitems_getItem(e1, indexname1)
print(item1)
levelvalue1 = tonumber(listitem_getCaption(item1))--this is the level selected
print("level value", levelvalue1)
subitems1 = listitem_getSubItems(item1)
print("subitems", subitems1)
expvalue1 = tonumber(strings_getString(subitems1, 0))
print("The exp is", expvalue1)

nextindexname = indexname + 1
--print("next index", nextindex)
nextitem = listitems_getItem(e, nextindexname)
--print("next item", nextitem)
nextlevelvalue = tonumber(listitem_getCaption(nextitem))
--print("next level value", nextlevelvalue)
nextsubitems = listitem_getSubItems(nextitem)
--print("next subitems", nextsubitems)
nextexpvalue = tonumber(strings_getString(nextsubitems, 0))
--print("the next exp is", nextexpvalue)
local addresslist1 = getAddressList()
print("after getting the table addresses")

This print statement is not executed, deleting the local part of the getAddressList1 gave the same error.
Code:

  heronamelevel1 = addresslist_getMemoryRecordByDescription(addresslist1, "Hero 1 Exp")
  heronamelevelE1 = addresslist_getMemoryRecordByDescription(addresslist1, "Hero 1 Exp 16^6")
  print("hero", heroname, "exp table address is",heronamelevel1)
  print("hero", heroname, "ext exp table address is",heronamelevelE1)
  memoryrecord_setValue(heronamelevel1, expvalue - math.floor(expvalue/65536) * 65536)--this only would work to 16^4
  memoryrecord_setValue(heronamelevelE1, math.floor(expvalue/65536))
heronamelevel1 = nil
heronamelevelE1 = nil
end

function CEListView2Click(sender)
print('Selected index for list 2 = '..listview_getItemIndex(CheatPanel_CEListView2))
indexname2 = listview_getItemIndex(CheatPanel_CEListView2)
e2 = listview_getItems(CheatPanel_CEListView2)
item2 = listitems_getItem(e2, indexname2)
print(item2)
levelvalue2 = tonumber(listitem_getCaption(item2))--this is the level selected
print("level value", levelvalue2)
subitems2 = listitem_getSubItems(item2)
print("subitems", subitems2)
expvalue2 = tonumber(strings_getString(subitems2, 0))
print("The exp is", expvalue2)
local addresslist2 = getAddressList()
  heronamelevel2 = addresslist_getMemoryRecordByDescription(addresslist2, "Hero 2 Exp")
  heronamelevelE2 = addresslist_getMemoryRecordByDescription(addresslist2, "Hero 2 Exp 16^6")
  memoryrecord_setValue(heronamelevel2, expvalue - math.floor(expvalue/65536) * 65536)--this only would work to 16^4
  memoryrecord_setValue(heronamelevelE2, math.floor(expvalue/65536))
  heronamelevel2 = nil
  heronamelevelE3 = nil
end

function CEListView3Click(sender)
print('Selected index for list 3 = '..listview_getItemIndex(CheatPanel_CEListView3))
indexname3 = listview_getItemIndex(CheatPanel_CEListView3)
e3 = listview_getItems(CheatPanel_CEListView3)
item3 = listitems_getItem(e3, indexname3)
print(item3)
levelvalue3 = tonumber(listitem_getCaption(item3))--this is the level selected
print("level value", levelvalue3)
subitems3 = listitem_getSubItems(item3)
print("subitems", subitems3)
expvalue3 = tonumber(strings_getString(subitems3, 0))
print("The exp is", expvalue3)
local addresslist3 = getAddressList()
  heronamelevel3 = addresslist_getMemoryRecordByDescription(addresslist3, "Hero 3 Exp")
  heronamelevelE3 = addresslist_getMemoryRecordByDescription(addresslist3, "Hero 3 Exp 16^6")
  memoryrecord_setValue(heronamelevel3, expvalue - math.floor(expvalue/65536) * 65536)--this only would work to 16^4
  memoryrecord_setValue(heronamelevelE3, math.floor(expvalue/65536))
  heronamelevel3 = nil
  heronamelevelE3 = nil
end
form_show(CheatPanel)

1. What needs to be changed to allow the addresslist1 = getAddressList() to work?
2. How to put only 35 values into the listview?
3. What code lines to add to hide the the listview, since those comments led to the stack overflow? Is there a code to "check" whether a form is hidden/not hidden?

EDIT:
After struggling through a couples of days at changing variable names, the first question is solved. The code works putting the exp values into the right spots once selected.
After working with the code on all three listviews, the first list view still has 20029 entries, while the other two have 35 and 30 entries YAH.
I tinkered a bit, entering
Code:
listview_clear(CheatPanel_CEListView1)
listview_clear(CheatPanel_CEListView2)
listview_clear(CheatPanel_CEListView3)

into the print debug window and executing, then hit the "execute script" button on the Lua script window and the code adds the correct number of items into all the lists.
So now why does (snipped) the code for the first listview enter 20029 lines and the second and third enter 35 and 30?
Code:

function addLevelItem1(level, exp)
local lvitems1=listview_getItems(CheatPanel_CEListView1)
local item1=listitems_add(lvitems1)
local subitems1=listitem_getSubItems(item1)
listitem_setCaption(item1,level)
strings_add(subitems1, exp)
end
addLevelItem1(1, 11)
addLevelItem1(2, 31)
addLevelItem1(3, 71)
...
addLevelItem1(35, 409999)
print("list view items added")

function addLevelItem2(level, exp)
local lvitems2=listview_getItems(CheatPanel_CEListView2)
local item2=listitems_add(lvitems2)
local subitems2=listitem_getSubItems(item2)
listitem_setCaption(item2,level)
strings_add(subitems2, exp)
end
addLevelItem2(1, 23)
addLevelItem2(2, 59)
addLevelItem2(3, 109)
...
addLevelItem2(35, 519999)

function addLevelItem3(level, exp)
--listview_clear(CheatPanel_CEListView3)
local lvitems3=listview_getItems(CheatPanel_CEListView3)
local item3=listitems_add(lvitems3)
local subitems3=listitem_getSubItems(item3)
listitem_setCaption(item3,level)
strings_add(subitems3, exp)
end
addLevelItem3(1, 99)
addLevelItem3(2, 299)
...
addLevelItem3(30, 539999)

Also is there command to check the hidden/unhidden state of a form?
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sat Feb 23, 2013 10:44 pm    Post subject: Timer question Reply with quote

I don't if anyone saw my edit to the last post, but I still can't get the first listview under 20K entries, unless I do it manually.

Anyway, another question concerning a timer.
I put one in a different game than the one with the listview problem, but the timer began its check and write function immediately after opening, only the table hadn't been re-calculated and created some bad items in the game. Shut it down, so my question how(where) does one put in timer_setEnabled(t, false) and then set an timer_setEnabled(t, true) at the last line of my recalculation function and have it work after the table has correct addresses?
Code:
t = createTimer(nil, true)
timer_onTimer(t, MaxHP)
timer_setInterval(t, 500)
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sun Feb 24, 2013 5:19 am    Post subject: Reply with quote

You might be better off using the onCreate event of the form, or clear the list each time you add items


for the timer: timer_setEnabled(t, true/false)

_________________
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
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sun Feb 24, 2013 9:13 am    Post subject: Reply with quote

1. Tried your suggestion and got rid of the 20K(mostly Level 1 11)
However, the listviews not correct, yet. I deleted all the code with the exception of the add items to listviews, radiogroup and listview clicks, again no snipping and sorry for the length:
Code:

function FormCreate(sender)
listview_clear(CheatPanel_CEListView1)
listview_clear(CheatPanel_CEListView2)
listview_clear(CheatPanel_CEListView3)
end

function addLevelItem1(level, exp)
local lvitems1=listview_getItems(CheatPanel_CEListView1)
local item1=listitems_add(lvitems1)
local subitems1=listitem_getSubItems(item1)
listitem_setCaption(item1,level)
strings_add(subitems1, exp)
end
addLevelItem1(1, 11)
addLevelItem1(2, 31)
addLevelItem1(3, 71)
addLevelItem1(4, 139)
addLevelItem1(5, 279)
addLevelItem1(6, 559)
addLevelItem1(7, 999)
addLevelItem1(8, 1799)
addLevelItem1(9, 2799)
addLevelItem1(10, 3899)
addLevelItem1(11, 5299)
addLevelItem1(12, 7599)
addLevelItem1(13, 9999)
addLevelItem1(14, 12999)
addLevelItem1(15, 16999)
addLevelItem1(16, 20999)
addLevelItem1(17, 25999)
addLevelItem1(18, 31999)
addLevelItem1(19, 39999)
addLevelItem1(20, 49999)
addLevelItem1(21, 61999)
addLevelItem1(22, 74999)
addLevelItem1(23, 89999)
addLevelItem1(24, 106999)
addLevelItem1(25, 126999)
addLevelItem1(26, 149999)
addLevelItem1(27, 174999)
addLevelItem1(28, 199999)
addLevelItem1(29, 229999)
addLevelItem1(30, 259999)
addLevelItem1(31, 289999)
addLevelItem1(32, 319999)
addLevelItem1(33, 349999)
addLevelItem1(34, 379999)
addLevelItem1(35, 409999)
print("list view 1 items added")

function addLevelItem2(level, exp)
--listview_clear(CheatPanel_CEListView2)
local lvitems2=listview_getItems(CheatPanel_CEListView2)
local item2=listitems_add(lvitems2)
local subitems2=listitem_getSubItems(item2)
listitem_setCaption(item2,level)
strings_add(subitems2, exp)
end
addLevelItem2(1, 23)
addLevelItem2(2, 59)
addLevelItem2(3, 109)
addLevelItem2(4, 199)
addLevelItem2(5, 379)
addLevelItem2(6, 699)
addLevelItem2(7, 1299)
addLevelItem2(8, 2399)
addLevelItem2(9, 3999)
addLevelItem2(10, 5999)
addLevelItem2(11, 8199)
addLevelItem2(12, 10999)
addLevelItem2(13, 14999)
addLevelItem2(14, 18999)
addLevelItem2(15, 23999)
addLevelItem2(16, 29999)
addLevelItem2(17, 36999)
addLevelItem2(18, 45999)
addLevelItem2(19, 56999)
addLevelItem2(20, 69999)
addLevelItem2(21, 84999)
addLevelItem2(22, 99999)
addLevelItem2(23, 115999)
addLevelItem2(24, 133999)
addLevelItem2(25, 155999)
addLevelItem2(26, 181999)
addLevelItem2(27, 209999)
addLevelItem2(28, 239999)
addLevelItem2(29, 279999)
addLevelItem2(30, 309999)
addLevelItem2(31, 339999)
addLevelItem2(32, 379999)
addLevelItem2(33, 429999)
addLevelItem2(34, 479999)
addLevelItem2(35, 519999)
print("list view 2 items added")

function addLevelItem3(level, exp)
--listview_clear(CheatPanel_CEListView3)
local lvitems3=listview_getItems(CheatPanel_CEListView3)
local item3=listitems_add(lvitems3)
local subitems3=listitem_getSubItems(item3)
listitem_setCaption(item3,level)
strings_add(subitems3, exp)
end
addLevelItem3(1, 99)
addLevelItem3(2, 299)
addLevelItem3(3, 599)
addLevelItem3(4, 1199)
addLevelItem3(5, 2399)
addLevelItem3(6, 4199)
addLevelItem3(7, 6399)
addLevelItem3(8, 8999)
addLevelItem3(9, 11999)
addLevelItem3(10, 15999)
addLevelItem3(11, 19999)
addLevelItem3(12, 24999)
addLevelItem3(13, 30999)
addLevelItem3(14, 38999)
addLevelItem3(15, 49999)
addLevelItem3(16, 64999)
addLevelItem3(17, 82999)
addLevelItem3(18, 102999)
addLevelItem3(19, 124999)
addLevelItem3(20, 149999)
addLevelItem3(21, 179999)
addLevelItem3(22, 219999)
addLevelItem3(23, 269999)
addLevelItem3(24, 299999)
addLevelItem3(25, 329999)
addLevelItem3(26, 359999)
addLevelItem3(27, 399999)
addLevelItem3(28, 449999)
addLevelItem3(29, 474463)
addLevelItem3(30, 539999)
print("list view 3 items added")

function CERadioGroup1Click(sender)
--print("Index ", radiogroup_getItemIndex(CheatPanel_CERadioGroup1))
indexname = radiogroup_getItemIndex(CheatPanel_CERadioGroup1)
h = radiogroup_getItems(CheatPanel_CERadioGroup1)
heroname = strings_getString(h, indexname)
--print(heroname)
  if heroname == "Hero 1" then
    form_show(CheatPanel_CEListView1)
  elseif heroname == "Hero 2" then
    form_show(CheatPanel_CEListView2)
  elseif heroname == "Hero 3" then
    form_show(CheatPanel_CEListView3)
  else
  end
if expvalue ~= nil and goldvalue ~= nil and heroname ~= nil then
--RecalculateAddresses()
end
end

--Recalculate


function CEListView1Click(sender)
--print("show list view 1")
print('Selected index for list 1 = '..listview_getItemIndex(CheatPanel_CEListView1))
indexname1 = listview_getItemIndex(CheatPanel_CEListView1)
e1 = listview_getItems(CheatPanel_CEListView1)
item1 = listitems_getItem(e1, indexname1)
--print(item1)
levelvalue1 = tonumber(listitem_getCaption(item1))--this is the level selected
--print("level value", levelvalue1)
subitems1 = listitem_getSubItems(item1)
--print("subitems", subitems1)
expvalue1 = tonumber(strings_getString(subitems1, 0))
--print("The exp is", expvalue1)

nextindexname1 = indexname1 + 1
--print("next index", nextindex1)
nextitem1 = listitems_getItem(e1, nextindexname1)
--print("next item", nextitem)
nextlevelvalue1 = tonumber(listitem_getCaption(nextitem1))
--print("next level value", nextlevelvalue)
nextsubitems1 = listitem_getSubItems(nextitem1)
--print("next subitems", nextsubitems)
nextexpvalue1 = tonumber(strings_getString(nextsubitems1, 0))
--print("the next exp is", nextexpvalue1)
local addresslist1 = getAddressList()
--print("after getting the table addresses")
  heronamelevel1 = addresslist_getMemoryRecordByDescription(addresslist1, "Hero 1 Exp")
  heronamelevelE1 = addresslist_getMemoryRecordByDescription(addresslist1, "Hero 1 Exp 16^6")
  --print("hero", heroname, "exp table address is",heronamelevel1)
  --print("hero", heroname, "ext exp table address is",heronamelevelE1)
  memoryrecord_setValue(heronamelevel1, expvalue1 - math.floor(expvalue1/65536) * 65536)--this only would work to 16^4
  memoryrecord_setValue(heronamelevelE1, math.floor(expvalue1/65536))
  heronamelevel1 = nil
  heronamelevelE1 = nil
form_hide(CheatPanel_CEListView1)
end

function CEListView2Click(sender)
print('Selected index for list 2 = '..listview_getItemIndex(CheatPanel_CEListView2))
indexname2 = listview_getItemIndex(CheatPanel_CEListView2)
e2 = listview_getItems(CheatPanel_CEListView2)
item2 = listitems_getItem(e2, indexname2)
--print(item2)
levelvalue2 = tonumber(listitem_getCaption(item2))--this is the level selected
--print("level value", levelvalue2)
subitems2 = listitem_getSubItems(item2)
--print("subitems", subitems2)
expvalue2 = tonumber(strings_getString(subitems2, 0))
--print("The exp is", expvalue2)
local addresslist2 = getAddressList()
  heronamelevel2 = addresslist_getMemoryRecordByDescription(addresslist2, "Hero 2 Exp")
  heronamelevelE2 = addresslist_getMemoryRecordByDescription(addresslist2, "Hero 2 Exp 16^6")
  memoryrecord_setValue(heronamelevel2, expvalue2 - math.floor(expvalue2/65536) * 65536)--this only would work to 16^4
  memoryrecord_setValue(heronamelevelE2, math.floor(expvalue2/65536))
  heronamelevel2 = nil
  heronamelevelE3 = nil
form_hide(CheatPanel_CEListView2)
end

function CEListView3Click(sender)
print('Selected index for list 3 = '..listview_getItemIndex(CheatPanel_CEListView3))
indexname3 = listview_getItemIndex(CheatPanel_CEListView3)
e3 = listview_getItems(CheatPanel_CEListView3)
item3 = listitems_getItem(e3, indexname3)
--print(item3)
levelvalue3 = tonumber(listitem_getCaption(item3))--this is the level selected
--print("level value", levelvalue3)
subitems3 = listitem_getSubItems(item3)
--print("subitems", subitems3)
expvalue3 = tonumber(strings_getString(subitems3, 0))
--print("The exp is", expvalue3)
local addresslist3 = getAddressList()
  heronamelevel3 = addresslist_getMemoryRecordByDescription(addresslist3, "Hero 3 Exp")
  heronamelevelE3 = addresslist_getMemoryRecordByDescription(addresslist3, "Hero 3 Exp 16^6")
  memoryrecord_setValue(heronamelevel3, expvalue3 - math.floor(expvalue3/65536) * 65536)--this only would work to 16^4
  memoryrecord_setValue(heronamelevelE3, math.floor(expvalue3/65536))
  heronamelevel3 = nil
  heronamelevelE3 = nil
form_hide(CheatPanel_CEListView3)
end

form_show(CheatPanel)


Then I pasted:
listview_clear(CheatPanel_CEListView1)
listview_clear(CheatPanel_CEListView2)
listview_clear(CheatPanel_CEListView3)
into the print window and executed; saved the table and exited CE.
Re-opened CE and the image is after selecting all three radiogroups and the appriate level presented within the listviews. One can see that the level items are added to listview1 and listview2 twice and listview3 have 8 additions. What now?

2. I realize that command needed to be added, I was asking where is the appropriate(best) location for the command to not enable? After setInterval?



ListViewAfterThirdSelect.png
 Description:
 Filesize:  20.55 KB
 Viewed:  11618 Time(s)

ListViewAfterThirdSelect.png


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

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

PostPosted: Sun Feb 24, 2013 6:30 pm    Post subject: Reply with quote

1: Check that the code you wish to have global and executed each time to be outside of a function and the code you wish to only execute when at specific times to be inside a function

I have no idea what you're talking about though as I see no listview in your form. If you use the listview as a database in the background don't. Use a table {} instead

2: Only start the timer when all the data is correct

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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