How do I randomly set a tag?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

A tag can be turned on and off randomly with a the following plotscript:

plotscript, randomize tag, begin
  set tag(tag: tag name, random(0, 1))
end

This works because the number 0 is the same as OFF or false, and the number 1 is the same as ON or true.

Or if you prefer to use tag numbers instead of tag:name constants;

plotscript, randomize tag, begin
  set tag([2-15999], random(0, 1))
end

Where [2-15999] is replaced with just the the tag number. (You cannot change tags 0 or 1.)


You could also use an argument for the tag number, like this:

script, randomize tag, which tag, begin
  set tag(which tag, random(0, 1))
end

then from inside some other script you could do:

randomize tag(tag: tag name)
randomize tag([2-159999])