View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Apr 09, 2013 7:32 am Post subject: memoryrecord_getValue() problems |
|
|
Part of a code using 6.2 is:
Code: |
maxhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Max HP")
maxhp = memoryrecord_getValue(maxhpaddress)
curhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Cur HP")
curhp = memoryrecord_getValue(curhpaddress)
maxmpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Max MP")
maxmp = memoryrecord_getValue(maxmpaddress)
curmpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Cur MP")
curmp = memoryrecord_getValue(curmpaddress)
magickeyaddress = addresslist_getMemoryRecordByDescription(addresslist, "Magic Keys")
magickey = memoryrecord_getValue(addresslist, magickeyaddress)
goldaddress = addresslist_getMemoryRecordByDescription(addresslist, "Gold Amount")
goldamount = memoryrecord_getValue(addresslist, goldaddress)
curgold = goldamount
commandscreenaddress = addresslist_getMemoryRecordByDescription(addresslist, "Command Screen (N-0 Y-255)")
commandscreen = memoryrecord_getValue(addresslist, commandscreenaddress)
if curhp ~= maxhp then
memoryrecord_setValue(curhpaddress, maxhp)
--print("changed cur hp")
end
if curmp ~= maxmp then
memoryrecord_setValue(curmpaddress, maxmp)
--print("changed cur mp")
end
if magickeys ~= 6 then
memoryrecord_setValue(magickeyaddress, 6)
end
if commandscreen == 255 then
gold = curgold
end
|
This part
goldamount = memoryrecord_getValue(addresslist, goldaddress)
curgold = goldamount
commandscreenaddress = addresslist_getMemoryRecordByDescription(addresslist, "Command Screen (N-0 Y-255)")
commandscreen = memoryrecord_getValue(addresslist, commandscreenaddress)
and this part
if magickeys ~= 6 then
memoryrecord_setValue(magickeyaddress, 6)
end
if commandscreen == 255 then
gold = curgold
end
were added this morning.
The first address references entered much earlier than today work fine
maxhpaddress
curhpaddress
maxmpaddress
curmpaddress
The addresses entered today don't work. I have tried the "Execute script" button and saving and re-opening the table, but they still don't work.
Any suggestions?
Description: |
|
Filesize: |
35.37 KB |
Viewed: |
11461 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Tue Apr 09, 2013 7:44 am Post subject: |
|
|
Code: |
goldamount = memoryrecord_getValue(addresslist, goldaddress)
|
will cause random/unspecified behavior as addresslist is not a memoryrecord object (same for magic key)
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Apr 09, 2013 7:47 am Post subject: |
|
|
OK, I guess the earlier entered lines didn't cause the same error, as they were identical in structure.
What is the more appropriate way to code the the memoryrecord_getValue() line?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Tue Apr 09, 2013 8:23 am Post subject: |
|
|
It might work because often (not always) the parameters are counted from the last given parameter and back
Anyhow, read main.lua to see how to call memoryrecord_getValue
memoryrecord_getValue only takes 1 parameter, the memoryrecord object, and returns the value as a string. So you probably want
Code: |
goldamount =memoryrecord_getValue(goldaddress)
|
also, I recommend using better names for variables. goldaddress is not an address. It's a memoryrecord object. (e.g goldmemrec)
Are you sure that both strings are the same? (e.g. no invisible characters)
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Apr 09, 2013 8:30 am Post subject: |
|
|
Ok
The command returns the address of the table object, tha is why I uded the descriptor, perhaps goldmemrecaddress?
Are you sure that both strings are the same? (e.g. no invisible characters)
Normally what I do is to copy the Description from the table and copy it to the code
EDIT:
I understand the error comment, take the addresslist OUT OF THE memoryrecord_getValue() line
thanks Mother of hack
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Apr 22, 2013 3:41 pm Post subject: |
|
|
Another question using the same scripted lines
maxhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Max HP")
maxhp = memoryrecord_getValue(maxhpaddress)
curhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Cur HP")
curhp = memoryrecord_getValue(curhpaddress)
if curhp ~= maxhp then
memoryrecord_setValue(curhpaddress, maxhp)
end
Is there another way than with the above type coding to hold a value constant(like the check box on the table)?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Apr 22, 2013 4:09 pm Post subject: |
|
|
This code should freeze the hp value to the value of Max HP (You can also do this without any kind of lua coding, check the checkbox and then change the value)
Code: |
memoryrecord_freeze(maxhp) --first freeze
memoryrecord_setValue("(Max HP)") --update the freeze value with (Max HP) so each freeze will query the Max HP value
|
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Apr 22, 2013 4:34 pm Post subject: |
|
|
lol, I realize one could use the check box. I was referring to a code.
It seems that this code would freeze the value and not let it change. Would something like this work?
addresslist = getAddressList()
curmp = memory_getValue(addresslist_getMemoryRecordByDescription(addresslist, "Max MP"))
memoryrecord_freeze(curhp)
|
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Mon Apr 22, 2013 4:39 pm Post subject: |
|
|
yup
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Apr 22, 2013 5:50 pm Post subject: |
|
|
no it won't update the health to the max hp when max hp changes
if you freeze the record first and THEN change the value to "(Max HP)" it will freeze the value to the current value of "Max HP"
If you freeze a address the "freeze value" will be set to the value it had at the time of the freeze
setting a value on a frozen record updates the value being set to the value you want it to be.
Setting the value to a special value like (Max HP) will cause the freeze to apply that effect constantly instead of once
First freeze, then change value. That's the important part of this feature
_________________
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 |
|
|
|