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 


Trainer to read and display a lot of values... scrolling?

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

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Fri Apr 10, 2015 4:01 pm    Post subject: Trainer to read and display a lot of values... scrolling? Reply with quote

So I've got a table for a game with a functioning AOB scan for the player structure and it'll pull up all the stats I can find. But now I want it as a trainer for people that only care to look at their stats.

The issue is that there's a LOT of stats. Even sometime as simple as "max HP" is split into three values (base, bonus, and then adjustment from equipment). I'm talking like 80+ entries total.

So my main concern is how will I fit all this data into a trainer?
Is there some container I can use that has a scrolling function or something?

_________________
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Sat Apr 11, 2015 4:24 pm    Post subject: Reply with quote

Use treeview?
Code:

+-John (player name)
 -+hp (display value)
  -+hp (component, sum of 3 children)
   --hp base
   --hp bonus
   --hp eq
 -+equipment
  -- helmet
  -- chest
  -- pant
  -- shot
  -- Left Hand
  -- Right Hand
+-Peter ... etc.


for hp components, may be show the component in another panel when hp is clicked.

Code:

+-John (player name)
 --hp (display value)
 --equipment
+-Peter ... etc.

==== detail panel
| hp-base:
| hp-bonus:
| hp-equip:


treeview's ScrollBars property can be set, eg ssAutoBoth
Memory Record is in tree structure btw.
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Wed Apr 15, 2015 12:05 pm    Post subject: Reply with quote

I ended up using a Memo box for it so users could copy-paste the output easily.


I'd like there to be some sort of loop I can make to help ease the importing of the entries from the cheat table into the display (for updates mainly)... but the issue is that it'd need to pull in the name and the type and then use the right function (readInteger(), readFloat(), etc.) and one of the functions is custom (for 2-byte values) and all that jazz.

So right now it looks something like this for the entries.


I'm guessing that setting up an automatic import script to do what I want would actually take more time and effort than just updating them manually every so often, right?

As far as I know I'd just be making a loop to run through the entries and have conditional statements depending on their value type that feed them through a different function, then trimming out the non-stat entries (like the base scan and various header entries) myself.

I'm asking just in case 'cause I'm unfamiliar with Lua

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Wed Apr 15, 2015 2:50 pm    Post subject: Reply with quote

You could do something like this using tables:
Code:
-- Store your cheats in a local table..
local cheats =
{
    { name = "STR (Base)",      addr = "_playerbase+214" },
    { name = "STR (Added)",     addr = "_playerbase+220" },
};

-- Add each cheat to the table..
for _, v in pairs(cheats) do
    UDF1.Memo.Lines.Add(string.format('%s: %s\r\n', v.name, readFloat(v.addr)));
end

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

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Thu Apr 16, 2015 7:00 am    Post subject: Reply with quote

The issue is the trainer would just be a user-friendly version of the table, so I'd still need to update two lists of codes like that. Also some values are float, others are 2 byte, 4 byte, or double.

EDIT: I forgot that CE tables are XML and I can just copy chunks of the table to work on, so I wrote this to turn all the entries into the chunk of code I can just copy-paste into the Lua form.

Code:
<?php
//Target output is...
//UDF1.Memo.Lines.Add("Defense (Added): "..readShortint("_playerbase+3f8"))

$source = file_get_contents("./source.txt");
$source_array = explode("<CheatEntry>",$source);

echo "<textarea name=\"output\" rows=\"40\" cols=\"120\">";

foreach ($source_array as $entry) {
   $entry_array = explode("\r\n", $entry);
   foreach ($entry_array as $line) {
      //Stick the important bits in the variables.
      //Description...
      if (substr($line,0,3) == "<De") {
         $description = substr($line,14);
         $description = str_replace("\"</Description>","",$description);
      }
      //Variable type...
      if (substr($line,0,3) == "<Va") {
         $variable_type = substr($line,14,1);
         if ($variable_type == "B") { $variable_type = "readShortint"; }
         if ($variable_type == 2) { $variable_type = "readShortint"; }
         if ($variable_type == 4) { $variable_type = "readInteger"; }
         if ($variable_type == "F") { $variable_type = "readFloat"; }
      }
      //Address...
      if (substr($line,0,3) == "<Ad") {
         $address = substr($line,9);
         $address = str_replace("</Address>","",$address);
      }
      
   }
   //Put the variables together into a line.
   echo "UDF1.Memo.Lines.Add(\"",$description,": \"..",$variable_type,"(\"",$address,"\"))\r\n";
}
echo "</textarea>";
?>

_________________
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