Weirdness with item slots
Posted: Fri Mar 01, 2013 6:56 am
Hi everyone,
Here's another entry level script that I wrote up. It works, but it doesn't quite work the way I want it to.
Here's the script first of all:
A few strange issues (strange to me anyhow) and questions:
1. The code works but only if I put the blue gems all in slot 7 or slot 8 of my characters. If I mix up to the two slots the teleporter doesn't deactivate. Why doesn't the "for j=7,8 do" actually work in this regard (I thought it counted to see if either slot was occupied)
2. The teleporter won't reactivate if the blue gems leave the characters hands. Why is this the case?
3. Should this script work at all (because it does to an extent) or have I found a lua loophole of some kind?
4. If it is mostly correct is there a cleaner or better way to write it?
Again, thanks for any help flung my way.
Here's another entry level script that I wrote up. It works, but it doesn't quite work the way I want it to.
Here's the script first of all:
Code: Select all
function lightCheck()
local j = "blue_gem"
for j=7,8 do
if party:getChampion(1):getItem(j) and
party:getChampion(2):getItem(j) and
party:getChampion(3):getItem(j) and
party:getChampion(4):getItem(j) then
if j then
teleporter_34:deactivate()
else
teleporter_34:activate()
end
end
end
end1. The code works but only if I put the blue gems all in slot 7 or slot 8 of my characters. If I mix up to the two slots the teleporter doesn't deactivate. Why doesn't the "for j=7,8 do" actually work in this regard (I thought it counted to see if either slot was occupied)
2. The teleporter won't reactivate if the blue gems leave the characters hands. Why is this the case?
3. Should this script work at all (because it does to an extent) or have I found a lua loophole of some kind?
4. If it is mostly correct is there a cleaner or better way to write it?
Again, thanks for any help flung my way.