Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Some weird call script stuff...

I'm doing alot of call script stuff with common events, don't ask me why, I just am.

Basically, when I found out I could write something other than numerical data into a $game_variables[0], I got all excited and thought I could use it for 'mode' names and stuff. But then I tried to use conditional branches and have stuff execute when you did it.

I made a one-touch door event that would open and close the door with a simple Common Event (and two pages, one with Self Switch A = ON).

I decided, I could make it so it could do it all four ways (incase somebody had a door graphic for side-doors).

So, I'd name the variable, "$game_variables[1] = 'left'" and sure enough it showed up when I pressed F9 as " 'left' ".

But then I tried to use it in a conditional branch

Code:
@>if $game_variables[1] == 'left'
  @>if Player facing Left
    @> (Makes door close, player takes 1 step forward.)
  End
End

And I noticed... it just doesn't do anything. It doesn't pop up a SyntaxError, so I know its not the way I wrote it... but it doesn't execute conditions. Also the same with this simple example...

Code:
@>Conditional Branch: Script: $game_variables[1] == 'already spoken'
  @>Text: So in other words... quit talking to me!
  @>
    Else
  @>Text: Hey, how's it goin'? What do you want? I don't think we've ever met before...
  @>Script: $game_variables[1] = 'already spoken'
  @>
  Branch End
@>end

In this second example, I expected him to say at least one of the phrases (the one that didn't meet any condition), but it just simply didn't do anything. Maybe I just need to get a life and try something different.

Is there a way to get the game to recognize oddball variables like that? Or do I have to modify one of the default scripts (like something in the interpreter) to get it to work in an evented conditional branch?
 

khmp

Sponsor

You are right the expression equates to nil. And that is neither true nor false.

Line 263 of the "Interpreter 3" change it to this:
Code:
      result = eval(@parameters[1]).nil? ? false : eval(@parameters[1])
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top