There are several mistakes in your (maunderingcabal's) script: "If (check tag(tag:2, on))" should be written "If (check tag(tag:2) == on)" (and actually the "== on" is completely unnecessary). And the if-then-else structure and placement of )/end's is wrong. Actually you should get rid of the 'else' and write "If (check tag(tag:2) == off)" instead. Finally instead of "tag:1" and "tag:2" you should put the real name of the tag, like "tag:achieved moondust"
But anyway for doing this all automatically instead of writing a different script for each item, to make more concrete what VSword said, you want to use an array. Normally I would use anarray of globals, but you could just as well use an array of tags. Lets say tags 1000+ are turned on once you have the achievement.
define constant(1000, item achievements)
Then you just want to loop over the items and check if you've gained one. Say you have up to 256 item definitions:
define constant(256, num items)
So the loop looks something like:
Code: Select all
plotscript, check item achievements, begin
variable(item)
for(item, 0, num items) do (
if (check tag(item achievements + item) == false) then ( # don't have the achievement yet
if (inventory(item) > 0) then (
# Show some kind of message. See what Sword said for more detail; but this just shows the name:
get item name(item, 1)
show textbox(10) # "Found the ${S1}"
set tag(item achievements + item, on)
)
)
)
end