FORUM ARCHIVED

What is the difference between repeat="1" and repeat="-1" in room scripts?

Discussion in 'Modding' started by Bohandas, Jul 11, 2013.

  1. Bohandas

    Bohandas Member

    In room scripts what is the difference between repeat="1" and repeat="-1"? Does anybody know?
     
  2. Kazeto

    Kazeto Member

    If the count is a positive number, the repetitions are finite. A count of "-1" means it will always repeat if all the other conditions are met.

    Well, sort of...
    Depending on the exact programming, "-1" here is either "infinite" or "finite but good luck getting there before you die" - the highest possible value of an unsigned variable used for checking, which usually tends to be int (the maximal value of unsigned int being 4.294.967.295).
     
    Bohandas likes this.
  3. Bohandas

    Bohandas Member

    Thanks.

    In a related followup question, could I therefore then put hitsNeededToBreak="-1" on a custombreakable and make an object that can be struck but not destroyed?
     
  4. Kazeto

    Kazeto Member

    I haven't tested it but at the very least it's worth trying. Either it will be reset to the lowest possible value or it will work as you intended it to - which of it happens depends on how the game's code is written.
     
  5. Bohandas

    Bohandas Member

    I tested this yesterday; turns out it makes the object spawn already broken (on a related note, the maximum allowable value for hitsneededtobreak is at least 999, possibly much higher, because I also tested that as a value and it worked).
     
    Kazeto likes this.
  6. Kazeto

    Kazeto Member

    Which means that the lowest allowed value is 0 and that it defaults to it then. It's is quite weird, honestly - I didn't expect them to allow a starting value of 0. But then again, they probably never saw it as detrimental, which would explain it quite well.
     
  7. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    It's probably a feature if anything: a breakable is basically a blocker that has an action: when used, remove this item and replace it with this other blocker, and switch it to passable.
     
    Kazeto likes this.