Jump to content
  • 2
Sign in to follow this  
Shadow72

Text Scripting Feedback/Suggestions

Question

I have been playing around with text scripting for a bit now and here are some suggestions I have.

  • Right now there is no way to share code between game logics. It would be nice to be able to import other yjs files in your script or to have global scripts that all scripts automatically have access to. However, right now you can share code between scripts in the same game logic, but if you need that code in multiple different game logics you would have to add that script to each of them. Then that becomes a problem if you want to do something like a gamemanager script where the script keeps track of the gamestate and whatnot.
     
  • We don't have i++, instead we have i += 1. It would be nice to have i++ since most people are used to typing that in javascript for loops.
     
  • It would be cool if we could create visual scripting tiles from text scripting. Allowing us to hide the more complex code in scripts and then use visual scripting to link it all together so it is easier to quickly change things(sort of like how UE4 does it). It would also allow people who don't want to get into text scripting a way to use other peoples text scripts in their own project without having to learn javascript.
     
  • Text script errors in chat blend together with multiple errors in a row. Would be nice to have some type of separator between the errors or even a new window that would pop up and display the error in a more easily readable way.
  • Upvote 1

Share this post


Link to post
Share on other sites

3 replies to this bug / suggestion

Recommended Posts

  • 0

Hi,

thank you for all your suggestions.

However, I do not understand the first one. You can use same .yjs file in any number of game logic objects.

 

There is no GUI support for global scripts at the moment but there is simple trick how to have them.

Just add to any GL (ok, it may be tricky to have it in the beginning of all scripts)

}

let myGlobalVariable = 6;

{

 

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, Houp said:

Hi,

thank you for all your suggestions.

However, I do not understand the first one. You can use same .yjs file in any number of game logic objects.

  

There is no GUI support for global scripts at the moment but there is simple trick how to have them.

 Just add to any GL (ok, it may be tricky to have it in the beginning of all scripts)


}

let myGlobalVariable = 6;

{

 

Sorry, I probably should have explained the first one better. Here's some pseudo code to help explain better.

class GameManager {
	constructor() {
		this.gameState = "WAITING_FOR_PLAYERS";
	}

	setState(newState) {
		this.gameState = newState;
	}
}

var myGameManager = new GameManger();

For the game manager I would need it in multiple different game logics so I could check the current gameState. But adding the same script to each game logic wouldn't work because if I set the new gameState to "IN_GAME" it would only update the gameManager for that single game logic, instead of all of them.

 

I also tried using the code you posted and it seems like we are only able to use "let" inside of functions in the experimental build.

Edited by Shadow72

Share this post


Link to post
Share on other sites
  • 0

I would suggest to use Global storage and then you can use in any other object:

function myFunction()
{
   let gameManager = YLogic.get(45);
   if (gameManager.gameState === "STARTED")
   {
   }
}

 

  • Thanks 1

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  

×