It's possible to use text substitution in a book using Aliases in a quest. Both the book and the text you want to substitute in must be aliases in the quest (I think, the CK is shut and I'm going from memory)
So, if you can get a global variable into an alias (I have never tried) then yes it is possible.
I forget the name of the note and quest that does this ... but the note is for an assassin to kill the player ... I'll look tomorrow, if you don't find it first.