Jump to content

getText() doesn't work


Maris

Recommended Posts

I made a mod, but it doesn't work properly.

111.png.44d4ee0e10348cb09396219f9f341129.png

 

It's very strange, because I made localization file properly and double checked it:

ContextMenu_EN = {
	ContextMenu_Annotation = "Annotation",
}

But for some reason it doen't work.

print("ContextMenu_Annotation" == getText("ContextMenu_Annotation")); --true!

Can somebody explain what am I doing wrong?

I was about to publish the mod but stucked on this issue.

 

CureVirus.zip

Link to comment
Share on other sites

It's strange. Now I can't reproduce. It seems that I must restart game. I thought that loading main menu should reload all mods.

 

Thank you.

 

There remained one last annoying bug. I have no idea what it is.

If you get CureVirus.CVZombieBlood, then cook it in oven, it become CVZombieBloodCooked. And then if you drag it to you inventory, it disappears! But if you drag it to the ground and then to inventory, all is ok.

Link to comment
Share on other sites

2 hours ago, Maris said:

It's strange. Now I can't reproduce. It seems that I must restart game. I thought that loading main menu should reload all mods.

 

Thank you.

 

There remained one last annoying bug. I have no idea what it is.

If you get CureVirus.CVZombieBlood, then cook it in oven, it become CVZombieBloodCooked. And then if you drag it to you inventory, it disappears! But if you drag it to the ground and then to inventory, all is ok.

 

Again, I can't reproduce this. I just cooked it and dragged into my inventory and it was fine.

Link to comment
Share on other sites

1 hour ago, Connall said:

 

Again, I can't reproduce this. I just cooked it and dragged into my inventory and it was fine.

I think Maris set ReplaceOnCooked in scripts.
Some modders have a issue with ReplaceOnCooked string in scripts, works good in SP but MP sometimes item banish when transfer to inventory. (Spawn in inventory and a second after doing that... banish)... If the server owner stops the server and restart, items banished spawns inside the stove inventory.

Link to comment
Share on other sites

5 hours ago, Snakeman said:

I think Maris set ReplaceOnCooked in scripts.
Some modders have a issue with ReplaceOnCooked string in scripts, works good in SP but MP sometimes item banish when transfer to inventory. (Spawn in inventory and a second after doing that... banish)... If the server owner stops the server and restart, items banished spawns inside the stove inventory.

Exactly.

I host local server (because there is admin panel and I can spawn items for testing).

The bug exists for me.

And if I stop the server and start again, raw uncooked CVZombieBlood appears again in the oven and I can cook it again with the same bug on dragging cooked blood to inventory.

module CureVirus
{
	...
	item CVAntivirus
	{
		...
		ReplaceOnCooked = CureVirus.CVAntivirusCooked,
		...
	}
	...
}

I could avoid using ReplaceOnCooked in scripts folder if there was something like Events.OnCooked.Add() or item:IsCooked() in lua.

Edited by Maris
Link to comment
Share on other sites

6 hours ago, Maris said:

Exactly.

I host local server (because there is admin panel and I can spawn items for testing).

The bug exists for me.

And if I stop the server and start again, raw uncooked CVZombieBlood appears again in the oven and I can cook it again with the same bug on dragging cooked blood to inventory.


module CureVirus
{
	...
	item CVAntivirus
	{
		...
		ReplaceOnCooked = CureVirus.CVAntivirusCooked,
		...
	}
	...
}

I could avoid using ReplaceOnCooked in scripts folder if there was something like Events.OnCooked.Add() or item:IsCooked() in lua.

yep!

Link to comment
Share on other sites

24 minutes ago, Snakeman said:

This happen also when add a item inside of objectcontainer in lua (MP)... when you transfer the item to your inventory banishes... you need to transfer item to floor first.

 

Any chance I could get an example mod of this to test this with, I'm curious to see what the issue might be.

Link to comment
Share on other sites

need to search... because when i detected that issue changed the code to add item on the floor.
like this:
self.character:getCurrentSquare():AddWorldInventoryItem(TheItem, self.character:getX() - math.floor(self.character:getX()), self.character:getY() - math.floor(self.character:getY()), self.character:getZ() - math.floor(self.character:getZ()));

 

i think not working code in MP: self.object:getInventory():additem() or additemonserver() (I can't remember very well)

Link to comment
Share on other sites

23 minutes ago, Connall said:

 

Any chance I could get an example mod of this to test this with, I'm curious to see what the issue might be.

I think the problem is the generation of item inside of worldobject inventory in MP. When you transfer that item to your inventory, system thinks its non valid item (dupe or like that) but if you transfer that item to floor first maybe system not check that... :P

I think it's the same code that adds ReplaceOnCooked.. because when you set this string and item finish to cooked... generate a new item inside of stove (Non player inventory)

Edited by Snakeman
Link to comment
Share on other sites

8 hours ago, Connall said:

 

Any chance I could get an example mod of this to test this with, I'm curious to see what the issue might be.

The mod from this topic is an exmaple. Raw blood -> cook -> can't drag cooked blood from oven to inventory (in multiplayer).

Edited by Maris
Link to comment
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...