Jump to content

BSL:Manual: Difference between revisions

800 bytes added ,  11 November 2017
workaround to bsl broken if conditions
m (pseudo code typo)
(workaround to bsl broken if conditions)
Line 208: Line 208:
  {
  {
     one_equals_two = input;
     one_equals_two = input;
}
Another workaround to this bug is too avoid local variables and boolean variables (as both seem to be buggy by default), so instead of using local variables you should use global variables and instead of boolean variables you should use int variables. The int variables can act as boolean values, you can use 1 to "true and 0 to "false".
Here's the code above working without the conditions bug, using the workaround with global variables and int variable acting as boolean:
var int one = 1;
var int two = 2;
var int one_equals_two = 0;
func void fixed_if(void)
{
   
    if (one eq two) # this condition will evaluate to false, but...
      one_equals_two = 1; # ...now this DOES'T run! Yeahhh!
    if (one_equals_two eq 1)
      dprint("Uh-oh.");
    else
      dprint("Phew.");
  }
  }


489

edits