Jump to content
Sign in to follow this  
Thimblerig

Setting a Global Variable from the tp2/Defining GAME_IS

Recommended Posts

I'd like to set up a tp2 so that, when it detects which platform it's using, it records that in a Global (which my dialogue files can read...)

 

eg. T1GameIs 1 = vanilla BG, T1GameIs 2 = BGT, T1GameIs 3 = EE...

 

Is there an easy way to do that?

Edited by Thimblerig

Share this post


Link to post

I'd be interested, too. Until now, all I can think of is "Make a script that gets patched to an appropriate in-game script that sets the appropriate variable" (like for bg1re, for example).

Share this post


Link to post

An alternative solution to the problem:

 

You could set up a WeiDU variable for each platform (GAMEISBGT, GAMEISTUTU, etc.) and initialize the value to True() if the current game matches that platform and False() otherwise.

OUTER_TEXT_SPRINT GAMEISBGT ~False()~
OUTER_TEXT_SPRINT GAMEISTUTU ~False()~
// etc.

ACTION_IF (GAME_IS ~bgt~) BEGIN
  OUTER_TEXT_SPRINT GAMEISBGT ~True()~
END
ELSE ACTION_IF (GAME_IS ~tutu tutu_totsc~) BEGIN
  OUTER_TEXT_SPRINT GAMEISTUTU ~True()~
END
// etc.

After setting these variables, compiling dialogues with EVALUATE_BUFFER would let you use them in your triggers to make replies and states that are only active on particular platforms.

Share this post


Link to post

Of course! I think I misunderstood the question completely. If you want to use different variable numbers for your .d-files upon instaling, using OUTER_SPRINT is the way to go.

 

I'd try a hack like

OUTER_SPRINT ~variable_value~ ~X~ With "X" being the different numbers you want for the different games.

 

In the .d, you would use "Global("T1GameIs","GLOBAL",%variable_value%)" and COMPILE EVALUATE_BUFFER

 

I'm at the wrong computer, but I could provide more code tonight if necessary.

Share this post


Link to post

And in case you don't want the alternative, it's the same idea as Mike presented--you set a variable with GAME_IS, and then abuse EVALUATE_BUFFER to get it into a script:

 

ACTION_IF (GAME_IS ~bgt~) BEGIN
  OUTER_SET game = 1
END ELSE 
ACTION_IF (GAME_IS ~tutu tutu_totsc~) BEGIN
  OUTER_SET game = 2
END ELSE 
ACTION_IF (GAME_IS ~bgee~) BEGIN
  OUTER_SET game = 3
END ELSE BEGIN // not bgt, tutu, or bgee; must be bg
  OUTER_SET game = 4
END

<<<<<<<<...\inlined\foo.baf
IF
  Global("T1GameIs","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("T1GameIs","GLOBAL",%game%)
END
>>>>>>>>

EXTEND_BOTTOM ~baldur.bcs~ ~...\inlined\foo.baf~ EVALUATE_BUFFER
That initial ACTION_IF/GAME_IS tree can be as complicated or simple as you want.

Share this post


Link to post

I ended up with a small handful of OUTER_SPRINT ~GAME_IS_EE~ ~True()~/~False~/~Monkeys!~ definitions along with the rest of the cross-platform variables: didn't take up much space, easy to read when I'm debugging files, and turns out all I needed was a very occasional True/False trigger. So that's okay.

 

Thank you for your help.

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...