Jump to content

Recommended Posts

Hello,

I'm making small feature for my mod. It just listen for specific key (in this example "O") and when I get this action, I change value of some strings. So far I've got piece of code, which theoretically do exacly that, I made myself sure, that it really listen to this key, but I suppose, that there needs to be some kind of refresh for loading all this values, because I can't see the change in the game right now.

There is what I've done so far:

TranslationSwapKeyHandler = Class(function(self)       self.handler = GLOBAL.TheInput:AddKeyHandler(function(key, down) self:OnRawKey(key, down) end )end)function TranslationSwapKeyHandler:OnRawKey(key, down)	if GLOBAL.IsPaused() or not GLOBAL.GetPlayer() then return end		if (key == GLOBAL.KEY_O and down) then		GLOBAL.STRINGS.NAMES.CUTGRASS = "Swapped test text."	endendTranslationSwapFeature = TranslationSwapKeyHandler()

Could you please help me with the "refreshing" part? Also I just realized, that I need to add some code to make that swap back after releasing that key.

 

Thanks for any help you can provide

Link to comment
https://forums.kleientertainment.com/forums/topic/27932-help-swap-strings/
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...