SCRMaps
/
Sign in

A condition is an object, not a true or false

Use a condition as if it were a value and you get a compile error that names neither the file nor the line.

5 min read

In epScript, Accumulate(P1, AtLeast, 50, Ore) does not return true or false. It returns a Condition object. That object has to belong to a trigger, and it is evaluated when that trigger runs in game - not where you declared it.

const c = Accumulate(P1, AtLeast, 50, Ore);
if (c) {            // 여기서 c 가 이 if 에 소속됩니다
    printAll("50 이상");
}
Declaring and belonging can be separate. The place it is evaluated is the if.

A condition belonging to no trigger is an orphan condition compile error - and because it is raised in the collecting phase it tells you neither file nor line, only eudplib's own internals. That is why it has a reputation for being hard to track down.

var bad = Accumulate(P1, AtLeast, 50, Ore);
// 고아 조건 오류. 변수 선언의 오른쪽은 값이 오는 자리이므로
// 조건을 표현식으로 쓴 것이 되고, 어디에도 소속되지 않습니다.

const ok = l2v(Accumulate(P1, AtLeast, 50, Ore));
// l2v = logic to value. 참이면 1, 거짓이면 0.
To turn a condition into a number, use l2v or the ternary operator.

There is a nastier case. Assigning a condition that already belongs somewhere to a variable is NOT an error - you get the condition object's memory address instead. A number north of 400 million sits in your variable and the compiler says nothing.

Sign in to track your progress