Jump to content
Sign in to follow this  
Badger 2-3

Compilation/Validation not working?

Recommended Posts

Few months ago I was working on a project for Reforger. Things worked! 

 

Came back today and I feel like things just.... don't work anymore? 

 

Anyone else having problems where the script editor no longer validates? For instance, I had a syntax error, clearly indicated at the beginning of the line with a circle w/ red X. However, when validating/compiling scripts everything was fine

Additionally I noticed the intellisense only works on Arma's stuff, when it used to work on my custom classes/variables and such. 

 

For giggles, thinking my project was just... old and needed an update - I created a new project and created a simple entity and component script. Neither of which were made available in the editor.

 

What in tarnation am I doing wrong? 

 

Event tried this attribute which worked in the past.

[EntityEditorProps(category: "GameScripted/GameMode/Badger", description: "Defines a spawn area for a given side")]

 

Have uninstalled, deleted everything (backed it up because that was a lot of work), then reinstalled both reforger and workbench. Nothing has worked so far. Any ideas?

Share this post


Link to post
Share on other sites

I have run into this issue where it loses the reference to the custom class and doesn't highlight properly. It seemed to me like it was part of a syntax error. if you have multiple declarations of the same class it will do this (Check your constructor area), as well as simple stuff like missing ";" will cause it all to crumble apart. you'll have to manually find the issue and resolve, then it all clears up and starts working again. 

Share this post


Link to post
Share on other sites

Oh I absolutely agree that the syntax problems would certainly cause problems with the code completion stuff. However, if this was syntax problem I should NOT be able to compile or pass the validation stage! Which is currently what I've been experiencing and it's been driving me nuts. When this first came out I highly praised this validation/compilation step because I got to see errors before running the game! 

 

I resorted to making a new project with only 1 script for the sole purpose of figuring out if they broke workbench or not. Everything that I did which worked between May to early June no longer works. I've tried a few different combinations trying to figure things out.... no joy. 

Share this post


Link to post
Share on other sites

Do you have any kind of errors in the console log?

Share this post


Link to post
Share on other sites

can you post your code of the 1 script here that we could look at? might be able to spot something that the debugger isn't picking up.

Share this post


Link to post
Share on other sites
[EntityEditorProps(category: "GameScripted/Badger", description: "Defines a spawn area for a given side", color: "0 0 255 255")]
class SCR_Badger_SpawnAreaClass : SCR_SpawnAreaClass
{
};

class SCR_Badger_SpawnArea : SCR_SpawnArea
{
	[Attribute("", UIWidgets.CheckBox, "Can this faction spawn if enemies are present in this area?", category: "Badger: Area")]
	protected bool m_bSpawnIfEnemyPresent;		
	
	private bool m_bCanSpawn = true;	
	
	FactionKey GetFaction() { return GetAffiliatedFactionKey(); }
	bool CanSpawn() { return m_aEnemies.Count() <= 0; }
	int GetSpawnRadius() { return GetSphereRadius(); }
	
	protected override void OnInit(IEntity owner)
	{
		super.OnInit(owner);

		// Supress messages out of playmode, order of things is not quite guaranteed here
		if (!GetGame().InPlayMode())
			return;
	}		
};

That's fair I should have uploaded a code sample.

 

I have tried it with AND without that EntityEditorProps attribute and cannot for the life of me get it into the game. This code used to work fine.

Have also tried using the category of "GameScripted/GameMode" just to see if it has to be an existing "path" or something.... no dice.

 

 

Share this post


Link to post
Share on other sites

 

obraz.thumb.png.42a5840e8c8d870b300b32f8cf0056b9.pngIt seems you have some hidden unicode (right side is code that I've copy pasted from here) character over there. Try the code that I've attached below and check if its working

 

[EntityEditorProps(category: "GameScripted/Badger", description: "Defines a spawn area for a given side", color: "0 0 255 255")]
class SCR_Badger_SpawnAreaClass : SCR_SpawnAreaClass
{
};

class SCR_Badger_SpawnArea : SCR_SpawnArea
{
	[Attribute("", UIWidgets.CheckBox, "Can this faction spawn if enemies are present in this area?", category: "Badger: Area")]
	protected bool m_bSpawnIfEnemyPresent;		
	
	private bool m_bCanSpawn = true;	
	
	FactionKey GetFaction() { return GetAffiliatedFactionKey(); }
	bool CanSpawn() { return m_aEnemies.Count() <= 0; }
	int GetSpawnRadius() { return GetSphereRadius(); }
	
	protected override void OnInit(IEntity owner)
	{
		super.OnInit(owner);

		// Supress messages out of playmode, order of things is not quite guaranteed here
		if (!GetGame().InPlayMode())
			return;
	}		
};

 

Share this post


Link to post
Share on other sites
26 minutes ago, reyhard said:

 

obraz.thumb.png.42a5840e8c8d870b300b32f8cf0056b9.pngIt seems you have some hidden unicode (right side is code that I've copy pasted from here) character over there. Try the code that I've attached below and check if its working

 


[EntityEditorProps(category: "GameScripted/Badger", description: "Defines a spawn area for a given side", color: "0 0 255 255")]
class SCR_Badger_SpawnAreaClass : SCR_SpawnAreaClass
{
};

class SCR_Badger_SpawnArea : SCR_SpawnArea
{
	[Attribute("", UIWidgets.CheckBox, "Can this faction spawn if enemies are present in this area?", category: "Badger: Area")]
	protected bool m_bSpawnIfEnemyPresent;		
	
	private bool m_bCanSpawn = true;	
	
	FactionKey GetFaction() { return GetAffiliatedFactionKey(); }
	bool CanSpawn() { return m_aEnemies.Count() <= 0; }
	int GetSpawnRadius() { return GetSphereRadius(); }
	
	protected override void OnInit(IEntity owner)
	{
		super.OnInit(owner);

		// Supress messages out of playmode, order of things is not quite guaranteed here
		if (!GetGame().InPlayMode())
			return;
	}		
};

 

 

 

I believe that was an artifact of copying the code block on this website to swap between the syntax highlighting.... was hard to read. 

Removing that unicode had no impact. 

 

IDK if this helps at all but I can write legitimately incorrect code -- where syntax is invalid yet the validation/compilation process succeeds without errors or warnings. It almost feels like it's not compiling/validation my project, but using a different location? When creating a project to test this, I use the default settings

 

I have uninstalled both game / tools more than a few times

Deleted the profile/addons off my machine

 

I'm stumped. 

Share this post


Link to post
Share on other sites

Where did you store that script? In any case, I've managed to compile and place that entity in game

unknown.png

Share this post


Link to post
Share on other sites

Whether it's in BadgerCore (Project Name), or in Scripts folder -- it doesn't have an impact. 

 

From the experience I had back in June (where this approach used to work) - that attribute made it discoverable in the editor under the create tab. It showed up as an entity I could place. 

unknown.png

 

Not sure if logs help

Compilation 1 started...
Succeeded: Engine( scripts/Core ) in 0ms
Succeeded: GameLib( scripts/GameLib ) in 30ms
Succeeded: Game( scripts/Game ) in 2030ms
Succeeded: Entities(  ) in 38ms
Succeeded: WorkbenchGame( scripts/WorkbenchGameCommon ) in 54ms
Succeeded: Workbench( scripts/WorkbenchCommon ) in 13ms
Compilation finished...
SCRIPT       : Reloading game scripts
SCRIPT       : Script validation
SCRIPT       : Compiling GameLib scripts
SCRIPT       : Compiling Game scripts

 

I promise I'm not crazy, I had a whole project working in the past. I got quite comfortable with scripting in this engine. But between Mid June and now It just... doesn't work.

unknown.png

Share this post


Link to post
Share on other sites

Game scripts have to be located in Scripts/Game folder. You can see in the logs, where games is checking for scripts actually

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×