Frictional Games Forum (read-only)

Full Version: Question with .lang and global variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I know a little about scripting but i need some help. I have a global variable set and i would like it to display when the player looks at a custom item in the inventory. Is there any way I can display the value of the variable in the .lang file during an entry script? So for example:

<CATEGORY Name="Inventory">
<Entry Name="ItemName_item">blah blah blah</Entry>
<Entry Name="ItemDesc_item"> XXXXXXXXXXXXX </Entry>
</CATEGORY>

I would like to somehow insert the value of the global variable in the "XXXXXXXXXXXXX" so when the player moves their mouse over, they see the set amount. Is this possible?
This is not possible without a bit of a "hack" unfortunately.

Solution 1 - Lots of values in the lang files
The only way you can achieve this effect is to create entries for the values which the variable may hold. For example: If you wanted to track "money" you could reasonably get away with 0-9999 without taking up too much space. You will probably want to write a program (or use my lang tool) to generate the numbers though.

Assuming you then name the entries like "m<value>" in a category called money you would be able to access the vars by getting the entry of "m"+GetLocalVarInt("money").

This is just a crude example and will need to tweaking for your scenario. If you are using floats, convert it into fixed-point integer & scale. If you are using strings then the solution is much more context dependant. This solution isn't unreasonable though, i used it for "time" and a death counter in a currently unreleased map.

Solution 2 - Billboarding / Light display
The other solution is to display the value in a specific location. You can then use box-lights with a numeric/alphabetic gobo to display digits. You could do the same billboards or entities, activating the appropriate thing for each digit/letter.

This limits the display to specific locations though, which may not be what you are looking for - but you will be able to display much greater ranges of information using this approach without any space tradeoffs. Be wary of having too many (>1k) box lights though - if you are going to need a large display think about using something else.
Can't you have like 10 Money Items and
For every Onpickup script have it do a check if player has item if not don't give the third money value and instead give the second value?