| View previous topic :: View next topic |
| Author |
Message |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Tue Nov 01, 2016 2:35 pm Post subject: Syntax for object language |
|
|
| Code: |
enemy1curhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Enemy 1 HP").Value
if tonumber(enemy1curhpaddress) >= 2 then
enemy1curhpaddress.Value = 1--with many iterations and changes
end
|
So how does one set the address's value?
|
|
| 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: Tue Nov 01, 2016 2:45 pm Post subject: |
|
|
{removed due to bknight2602's post below.}
_________________
Last edited by mgr.inz.Player on Tue Nov 01, 2016 3:14 pm; edited 1 time in total |
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Tue Nov 01, 2016 2:50 pm Post subject: |
|
|
| I didn't type it as I thought it, say the value in enemy1curhpaddress was 1527 and that the code seeing it greater than 2, sets the value at 1.
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Nov 01, 2016 2:58 pm Post subject: |
|
|
| Code: | enemy1curhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Enemy 1 HP")
if tonumber(enemy1curhpaddress.Value) >= 2 then
enemy1curhpaddress.Value = 1--with many iterations and changes
end |
|
|
| 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: Tue Nov 01, 2016 3:04 pm Post subject: |
|
|
Now I see, you mixed few things.
Old syntax with new syntax. Instead of
| Code: | | addresslist_getMemoryRecordByDescription(addresslist, "Enemy 1 HP") |
Use
| Code: | | addresslist.getMemoryRecordByDescription("Enemy 1 HP") |
You should use memrec object. Your code:
| Code: | | enemy1curhpaddress = addresslist.getMemoryRecordByDescription("Enemy 1 HP").Value |
You probably wanted this:
| Code: | | enemy1curhpaddress = addresslist.getMemoryRecordByDescription("Enemy 1 HP") |
Also, variable names are misleading. Whole script should be.
| Code: | enemy1curhp = addresslist.getMemoryRecordByDescription("Enemy 1 HP")
if tonumber(enemy1curhp.Value) >= 2 then
enemy1curhp.Value = 1
end |
PS: if you use addresslist object to only find memrec by description. You can use something like this:
| Code: | enemy1curhp = getTableEntry("Enemy 1 HP")
if tonumber(enemy1curhp.Value) >= 2 then
enemy1curhp.Value = 1
end |
_________________
|
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Tue Nov 01, 2016 3:20 pm Post subject: |
|
|
Those changes worked first time.
Thanks
|
|
| Back to top |
|
 |
|