Question with .lang and global variables - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Question with .lang and global variables (/thread-14394.html) |
Question with .lang and global variables - theabcs - 04-01-2012 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? RE: Question with .lang and global variables - Apjjm - 04-02-2012 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. RE: Question with .lang and global variables - Xanthos - 04-02-2012 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? |