|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Majin Advanced Cheater Reputation: 0
Joined: 04 May 2016 Posts: 87
|
Posted: Thu May 18, 2017 11:52 am Post subject: Extracting Line From Text Memo? |
|
|
I've a script that should be fairly simple. It functions as follows:
When activated,
Find specific table entries by their description
Assign them to an array - arrayRecords
Assign their values to a string array - arrayRecordStrings
Write the string array to a memo
Show the memo
When deactivated,
Hide the memo
Assign the memo to a string array, line by line - arrayMemoRecordStrings
Write the array's string values to the table entries through the arrayRecords array.
It all works as intended, right up until the end of the script, where it writes the memo's lines to the memory records. The for loop will only run one time, and the script will be stuck in the activated state (can't click off the red cross in the table's checkbox). So I'm probably doing something wrong.
Here's the script, with the problem part in bold:
Quote: |
[ENABLE]
{$lua}
--if not syntaxcheck then
windowMemo.memoRecordValues.Lines.Clear()
windowMemoFaceData.memoFaceData.Lines.Clear()
-- Get the memory records
listAddresses = getAddressList()
dwLastBonfire = listAddresses.getMemoryRecordByDescription('DWord - Last Bonfire')
strCharName = listAddresses.getMemoryRecordByDescription('String - Character Name')
byEmbered = listAddresses.getMemoryRecordByDescription('Byte - Embered')
dwNGCounter = listAddresses.getMemoryRecordByDescription('DWord - NG+ Counter')
dwCurrentCov = listAddresses.getMemoryRecordByDescription('DWord - Current Covenant')
byMaxReinforce = listAddresses.getMemoryRecordByDescription('Byte - Max Reinforce Level')
aobPlayerStats = listAddresses.getMemoryRecordByDescription('AOB - Player Stats')
aobPlayerAttr01 = listAddresses.getMemoryRecordByDescription('AOB - Player Attributes 01')
aobPlayerAttr02 = listAddresses.getMemoryRecordByDescription('AOB - Player Attributes 02')
byClass = listAddresses.getMemoryRecordByDescription('Byte - Class')
aobEquippedGear = listAddresses.getMemoryRecordByDescription('AOB - Equipped Gear')
aobEquippedSpells = listAddresses.getMemoryRecordByDescription('AOB - Equipped Spells')
aobEquippedGestures = listAddresses.getMemoryRecordByDescription('AOB - Equipped Gestures')
aobUnlockedGestures = listAddresses.getMemoryRecordByDescription('AOB - Unlocked Gestures')
aobUnlockedEstus = listAddresses.getMemoryRecordByDescription('AOB - Unlocked Max Estus')
--create arrays
arrayRecords = {
dwLastBonfire,
strCharName,
byEmbered,
dwNGCounter,
dwCurrentCov,
byMaxReinforce,
aobPlayerStats,
aobPlayerAttr01,
aobPlayerAttr02,
byClass,
aobEquippedGear,
aobEquippedSpells,
aobEquippedGestures,
aobUnlockedGestures,
aobUnlockedEstus
}
arrayRecordStrings = {
dwLastBonfire.Value,
strCharName.Value,
byEmbered.Value,
dwNGCounter.Value,
dwCurrentCov.Value,
byMaxReinforce.Value,
aobPlayerStats.Value,
aobPlayerAttr01.Value,
aobPlayerAttr02.Value,
byClass.Value,
aobEquippedGear.Value,
aobEquippedSpells.Value,
aobEquippedGestures.Value,
aobUnlockedGestures.Value,
aobUnlockedEstus.Value
}
iRecordStringsCount = 15 -- Easier to keep track of the array size
iCounter = 1
for iCounter = 1,iRecordStringsCount do -- Add the array values to a memo
windowMemo.memoRecordValues.Lines.Add(arrayRecordStrings[iCounter])
end
windowMemo.Show()
scriptFacegenBackup = listAddresses.getMemoryRecordByDescription('Script - Save + Restore Current FaceData')
aobFaceData01 = listAddresses.getMemoryRecordByDescription('AOB - Facedata 01')
aobFaceData02 = listAddresses.getMemoryRecordByDescription('AOB - Facedata 02')
aobFaceData03 = listAddresses.getMemoryRecordByDescription('AOB - Facedata 03')
aobFaceData04 = listAddresses.getMemoryRecordByDescription('AOB - Facedata 04')
arrayFaceRecords = {
aobFaceData01,
aobFaceData02,
aobFaceData03,
aobFaceData04
}
scriptFacegenBackup.Active = true -- enable the facegen backup script
arrayFaceRecordStrings = {
aobFaceData01.Value,
aobFaceData02.Value,
aobFaceData03.Value,
aobFaceData04.Value
}
iFaceDataRecordsCount = 4
for iCounter = 1,iFaceDataRecordsCount do
windowMemoFaceData.memoFaceData.Lines.Add(arrayFaceRecordStrings[iCounter])
end
windowMemoFaceData.Show()
--end
{$asm}
[DISABLE]
{$lua}
--if not syntaxcheck then
windowMemo.Hide()
windowMemoFaceData.Hide()
arrayMemoRecordStrings = windowMemo.memoRecordValues.Lines
arrayMemoFaceDataStrings = windowMemoFaceData.memoFaceData.Lines
for iCounter = 1,iRecordStringsCount do
sleep(0.05)
ShowMessage(arrayMemoRecordStrings[iCounter])
arrayRecords[iCounter].Value = arrayMemoRecordStrings[iCounter]
end
for iCounter = 1,iFaceDataRecordsCount do
sleep(0.05)
arrayFaceRecords[iCounter].Value = arrayMemoFaceDataStrings[iCounter]
end
scriptFacegenBackup.Active = false
windowMemo.memoRecordValues.Lines.Clear()
windowMemoFaceData.memoFaceData.Lines.Clear()
{$asm}
--end
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri May 19, 2017 5:28 am Post subject: |
|
|
execute that lua script inb the lua engine window after enabling the cheat entry
it may tell you what's wrong
_________________
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 |
|
|
Majin Advanced Cheater Reputation: 0
Joined: 04 May 2016 Posts: 87
|
Posted: Fri May 19, 2017 1:29 pm Post subject: |
|
|
Dark Byte wrote: | execute that lua script inb the lua engine window after enabling the cheat entry
it may tell you what's wrong |
It just says:
Code: | Error:"TestName" is an invalid float
Script Error
|
TestName being the name of the character. The message box shown in first execution of the for loop shows the name as well.
The weird part is that it shouldn't be trying to set the value of the name cheat entry on the first iteration. It should be setting the 4-byte value of dwLastBonfire, as that is the first value in the arrayRecords array variable.
|
|
Back to top |
|
|
Majin Advanced Cheater Reputation: 0
Joined: 04 May 2016 Posts: 87
|
Posted: Thu May 25, 2017 11:09 am Post subject: |
|
|
Found the problem. CE's forms are Pascal based, so the arrays function differently from Lua's. You have to subtract 1 from the counter, as Pascal arrays start from 0.
Code: |
for iCounter = 1,iRecordStringsCount do
sleep(0.05)
ShowMessage(arrayMemoRecordStrings[iCounter])
arrayRecords[iCounter].Value = arrayMemoRecordStrings[iCounter - 1]
end
for iCounter = 1,iFaceDataRecordsCount do
sleep(0.05)
arrayFaceRecords[iCounter].Value = arrayMemoFaceDataStrings[iCounter - 1]
end
|
|
|
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
|
|