 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
Posted: Fri Dec 27, 2013 7:39 am Post subject: combo box readinteger amd writeinteger commands |
|
|
Hi. I created an editor for a sports simulation game. I wanted to create a combobox for nationality of a player.
It goes like if we write 44 in nationality adress player becomes english. If we type 45 he becomes indian etc
So ee hav to remeber the codes for different countries.
Is there a way where I can make a list of countries in a combo box. When users click on it, dropdown list shows up displaying various cointry name like england australia india.
Thw user selects one country then click on save (button for writeinteger), it should write 44, 45 etc in the adrress.
Eg he selects england and click on save button should write 44 in the adress of nationality
So what are the readinteger and writeinteger way for a combobox witg dropdown list?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Dec 27, 2013 9:17 am Post subject: |
|
|
Create a combobox and fill it with a bunch of strings describing what each entry does
e.g:
Code: |
England
Australia
India
|
Then assign an OnChange event to that combobox (or OnSelect)
And then check the ItemIndex property of the combobox in that function.
If the ItemIndex is 0, then England was chosen. If ItemIndex=1 then Australie, and if ItemIndex=2 then India is chosen.
If none of the above is chosen (e.g you allowed the user to type in stuff) then ItemIndex=-1
Then depending on the ItemIndex value use writeInteger on the specific address with the specific value. (E.g if ComboBox.ItemIndex==2 then writeInteger(address,45)
(Also, instead of writeInteger you could make use of the MemoryRecord that holds the address. The Value property is often easier to use as it picks the correct way to write the value for you)
_________________
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 |
|
 |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
Posted: Fri Dec 27, 2013 9:27 am Post subject: |
|
|
Do u hv an eg script for this with adress bring a multilevel pointer?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Dec 27, 2013 9:34 am Post subject: |
|
|
This code will set a memory record with description "Some Description" to 123
Code: |
getAddressList().getMemoryRecordByDescription("Some Description").Value=123
|
Alternatively, to write a multilevel pointer with writeInteger do something like:
Code: |
writeInteger("[[game.exe+123]+456]+78", 123)
|
_________________
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Dec 27, 2013 9:43 am Post subject: |
|
|
here is an example
(It will say there is a newer version of cheat engine out. Just ignore that. This table doesn't use any of the new stuff so will work with the original 6.3)
Description: |
|
 Download |
Filename: |
example.ct |
Filesize: |
1.49 KB |
Downloaded: |
1549 Time(s) |
_________________
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 |
|
 |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Dec 27, 2013 11:44 am Post subject: |
|
|
You didn't assign an onClick event to the button
open the table
click table->myform->edit
click cebutton
Click on the "events" tab
doubleclick on the right side of the OnClick event, or select it from the dropdown list
Now save the table and it'll work. (Close the form designer to test it)
_________________
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 |
|
 |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
Posted: Fri Dec 27, 2013 11:51 am Post subject: |
|
|
OOPS, what a silly mistake that was! The script i attached and u attached both are working perfect
Thankx
Btw how do i make a read command too.
That if the user click on Load player profile. The combo box should change to the string in combo box like in nationality case, It should show England etc and not the codes like 44. (readInteger command for combo box in my script? )
what to write after readInteger so that combo box changes accordingly?
LOL, im ADVANCED cheater now in forum rank. hehe. the tags are really cool and bring a smile on my face
Last edited by faizangmc on Fri Dec 27, 2013 12:05 pm; edited 1 time in total |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Dec 27, 2013 12:04 pm Post subject: |
|
|
Look at my example. It doesn't care about the value in the combo box, just the index
Just keep a database(table) that links an index with a combobox.
e.g if you read out a list of nationalities and their value, then fill the combobox with the names, and keep a table with the corresponding value.
Also, a lua table can use strings as table lookup, so you can do
writeInteger(address, mylookuptable[formname.comboboxname.Text])
where formname.comboboxname.Text is the name of the nationality
another lua example:
Code: |
s={}
b="weee"
s[b]=12
i=s["weee"]
|
Makes i==12
_________________
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 |
|
 |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
Posted: Fri Dec 27, 2013 12:24 pm Post subject: |
|
|
i understood partially. till before another lua example.
I have attached this table. Can you plz just make the necessary modifications that make the combo box change to the correct Nation after clicking on load nationality button.
I have written a readInteger command i used in my original editor which shows up the nationality code like 44, 45 in edit box. It cant be used with the combo box ofcourse.
Can you just change the script and upload? Even if for one nationality like India. Il learn from it.
I did try control_setCaption(control, caption)
Also, combobox_setItemIndex(combobox)
(if these two ever mean setting the 'displayed' string in combobox)
Also, whats the script for displaying "game loaded" for successfull attachment of the process?
Description: |
plz can you make the changes to this? |
|
 Download |
Filename: |
Cricket2013.CT |
Filesize: |
1.2 KB |
Downloaded: |
1412 Time(s) |
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Dec 27, 2013 8:06 pm Post subject: |
|
|
here is an example of using a table to lookup the entries
Quote: |
Also, whats the script for displaying "game loaded" for successfull attachment of the process?
|
Use OnOpenProcess for that
Also, read main.lua
Description: |
|
 Download |
Filename: |
Cricket2013.CT |
Filesize: |
1.15 KB |
Downloaded: |
1487 Time(s) |
_________________
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 |
|
 |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
Posted: Sat Dec 28, 2013 2:13 am Post subject: |
|
|
i think i cudnt explain my query properly. This is my original editor in which i used edit boxes. To load the player. I open the players profile in the game. then switch to editor. Click on refresh/load current player. And the below screenshot shows up how it loads. Basically i want the edit box to be replaced by combobox. When the user clicks on refresh/load current player. the current itemindex f combobox should change to the players nationality. Like in this case it should show England and not 44 like in edit box.
Screenshot might help.
Description: |
|
Filesize: |
220.21 KB |
Viewed: |
25719 Time(s) |

|
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Dec 28, 2013 3:04 pm Post subject: |
|
|
faizangmc wrote: | Thank you very much mgr.inz.Player
Country codes. (do only for the top 4 to 5 teams. il make for the rest of them as it will waste your time writing for all)
43 = Australia.......
44 = England........
45 = India............
46 = New Zealand.
47 = Pakistan.......
48 = South Africa..
49 = Sri Lanka......
50 = West Indies.. .
51 = Bangladesh...
52 = Zimbabwe.....
there are 8 more of them like below! it will be a waste of your time making such a long script. just give the script for a few of the above countries. (particularly top most like aus eng ind nz), once i learn the way to do it. il make the whole script. like you taught me for the edit boxes.
168 = Kenya
169 = Namibia |
OK, here:
Code: | Nationality = "[[[Cricket2013.exe+005D4D20]+c8]+b0]+1c"
-- create key-value table (country code is a key)
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',
[168]='Kenya',
[169]='Namibia'
}
-- create another key-value table (this time, country name is a key)
NationalitiesMirror = {}
for k,v in pairs(Nationalities) do
NationalitiesMirror[v]=k
end
function LoadClick(sender)
local country = Nationalities[ readInteger(Nationality) ]
-- there are few tricks:
-- someTable[nil] is always nil (readInteger returns nil, handled)
-- someTable[nonExistentKey] is always nil (unknown country code)
-- check if country is not nil
if country~=nil
then MyForm.CEComboBox1.Text = country -- set country
else MyForm.CEComboBox1.ItemIndex=-1 -- unknown country (Nationalities list incomplete or game state not loaded)
end
end
function SaveClick(sender)
if MyForm.CEComboBox1.ItemIndex < 0 then return end
writeInteger(Nationality,NationalitiesMirror[ MyForm.CEComboBox1.Text ] )
end
-- fill CEComboBox1
MyForm.CEComboBox1.Items.clear()
for _,v in pairs(Nationalities) do
MyForm.CEComboBox1.Items.Add(v)
end
-- set CEComboBox1 properties
MyForm.CEComboBox1.Sorted=true -- alphabetically
MyForm.CEComboBox1.ReadOnly=true
-- show form and set autoAttachList
MyForm.show()
getAutoAttachList().add("Cricket2013.exe")
|
_________________
|
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sat Dec 28, 2013 5:40 pm Post subject: |
|
|
Assuming you know how to use the following script (check bottom of it.. 2 simple functions).
Make sure you have a listbox or combobox to supply (first function).
You may also sort the listbox if you wish to.
Code: | errorOnLookupFailure(false); -- No errors with pointer
Cricket = { -- Main table, holds all the nation required functions and pointer and object (you may apply the same table to new object.. of course we tweaks we can make it run with 2 different instances)
Nations = { -- The key isn't must to be a string.. when there's no space.
['Australia'] = 43; ['England'] = 44; ['India'] = 45;
['New Zealand'] = 46; ['Pakistan'] = 47; ['South Africa'] = 48;
['Sri Lanka'] = 49; ['West Indies'] = 50; ['Bangladesh'] = 51;
['Zimbabwe'] = 52; ['Kenya'] = 168; ['Namibia'] = 169;
};
Pointer = "[[[Cricket2013.exe+005D4D20]+c8]+b0]+1c";
Object = nil;
Start = function (object)
Object = nil;
if (type(object) == 'userdata' and object.Items) then
Cricket.Object = object;
strings_clear(object.Items);
for k,v in pairs(Cricket.Nations) do
strings_add(object.Items, k);
end
end
end;
ReturnNation = function (object) -- supply object (listbox or whatever you want to read from and check)
if (object) then
if (type(object) ~= 'userdata') then
return nil
end
if (object.ItemIndex and object.ItemIndex>=0 and object.Items) then
local index = strings_getString(object.Items, object.ItemIndex)
return Cricket.Nations[index]
end
return nil
elseif (Cricket.Object) then
if (Cricket.Object.ItemIndex and Cricket.Object.ItemIndex>=0 and object.Items) then
local index = strings_getString(Cricket.Object.Items, Cricket.Object.ItemIndex)
return Cricket.Nations[index]
end
return nil
end
end;
SetNation = function (sender)
if readInteger(Cricket.Pointer) then
writeInteger(Cricket.Pointer, Cricket.ReturnNation())
return true
end
return false
end
}
-- Usage:
Cricket.Start(UDF1.CEListBox1) -- Fills the object with the countries, and stores the object..
Cricket.SetNation() -- Writes to the pointer the selected nation chosen... |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
faizangmc Expert Cheater
Reputation: 0
Joined: 12 Nov 2013 Posts: 167
|
Posted: Sun Dec 29, 2013 2:44 am Post subject: |
|
|
thank you very much both of you. you guys rock. Explain it in very easy words so that newbies like me understand.
mgr.inz.player when i run the script it gives this error :-
Code: | Error:[string "Nationality = "[[[Cricket2013.exe+005D4D20]..."]:47: attempt to call field 'Add' (a nil value) |
the script at line 47 is this :-
Code: | -- fill CEComboBox1
MyForm.CEComboBox1.Items.clear()
for _,v in pairs(Nationalities) do
MyForm.CEComboBox1.Items.Add(v)
end |
if i remove this script and add the strings in combo box manually through form editor. its working flaweless.
Also you can see the screenshot above. The date of birth of the player is weird. Its coded. and all the 3 values (day, month, year) are interlinked.
eg if players dob is 21/2/1989
the values will be in 3 boxes "0, 204, 223"
for 22/2/1989 (one day later) its "64, 204, 223"
for 23/2/1989 its "128, 204, 223"
for 24/2/1989 its "192, 204, 223"
for 25/2/1989 its ""0, 205, 223"
this can be done through the dob convertor someone made :
https://www.dropbox.com/s/ctawhv4mcl12oki/DOB%20to%20Code%20Converter.exe
But in 2008 editor some guy made an editor through vb showing the dob as mm/dd/yyyy format with some calculation in his script. I asked him the source code. In his source code the following script in vb seems to make the calcualtion. Anyway i can introduce this in my editor so that instead of the codes, the dob columns show dd/mm/yyyy format
Source code of vb :
Quote: |
private byte[] dobToCodes(DateTime DOB)
{
byte[] codes = new byte [3];
DateTime Default = new DateTime(1944, 11, 8, 0, 0, 0);
TimeSpan difference = DOB.Subtract(Default);
int multiplier = 1;
int startZ = 208;
if (difference.Days > 49152)
{
Default = new DateTime(2079, 6, 5, 0, 0, 0);
difference = DOB.Subtract(Default);
multiplier = 4;
startZ = 240;
}
else if (difference.Days > 16384)
{
Default = new DateTime(1989, 9, 17, 0, 0, 0);
difference = DOB.Subtract(Default);
multiplier = 2;
startZ = 224;
}
codes[0] = (byte)((difference.Days % (4 * multiplier)) * (64 / multiplier));
codes[1] = (byte)((((difference.Days / (4 * multiplier)) % 256)));
codes[2] = (byte)(((difference.Days / (1024 * multiplier)) + startZ));
return codes;
}
private void codesToDOB()
{
int bytesRead = 0;
long temp = playerAddress + cDOB;
byte []memory = pReader.ReadProcessMemory((IntPtr)temp, 4, out bytesRead);
int numDays = 0;
DateTime startDate = new DateTime(1944, 11, 8, 0, 0, 0);
int xOffset = 0;
int yOffset = 0;
int zOffset = 0;
int multiplier = 0;
int startZ = 0;
if ((memory[2] >= 208) && (memory[2] <= 223))
{
startDate = new DateTime(1944, 11, 8, 0, 0, 0);
multiplier = 1;
startZ = 208;
}
else if ((memory[2] >= 224) && (memory[2] <= 239))
{
startDate = new DateTime(1989, 9, 17, 0, 0, 0);
multiplier = 2;
startZ = 224;
}
else if ((memory[2] >= 240) && (memory[2] <= 255))
{
startDate = new DateTime(2079, 6, 5, 0, 0, 0);
multiplier = 4;
startZ = 240;
}
xOffset = memory[0] / (64 / multiplier);
yOffset = memory[1] * (4 * multiplier);
zOffset = (memory[2] - startZ) * 1024 * multiplier;
numDays = xOffset + yOffset + zOffset;
startDate = startDate.AddDays(numDays);
dobBox.Value = startDate;
|
|
|
Back to top |
|
 |
|
|
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
|
|