Confirm text replacement with template category text
All the text in the message will be deleted and replaced by text from category template.
Reply: Can not add the the Author text and the name who built the level in MBG
Topic History of: Can not add the the Author text and the name who built the level in MBG
Max. showing the last 20 posts - (Last post first)
- NF
-
Using a text editor like those RandomityGuy suggested also has the bonus of coloring the text in your code according to what its purpose is in the program. For example, I'm a Mac user, and my preferred text editor is Sublime Text, the editor which was used to code much of PlatinumQuest. Usually function names are colored teal, referenced function names and object types are blue, conditionals like while, if, etc. are purple, variable names are orange, operations like variable assignment and concatenation are red, strings in quotation marks are green, parentheses, braces, and other text are white, and comments are gray. This allows you to much more easily parse what is happening in the file you're working with, and to build an intuition for what will happen if you change something.
Now like RandomityGuy said, these text editors have brace-matching capabilities. In Sublime Text, for example, if you have the cursor right after a brace or parenthesis, it will underline both that brace and its pair in orange so that you can make sure both are in the right place. If you have an extra brace or parenthesis, the text editor will highlight it bright red to show that it doesn't end anything and should be removed. If you're missing one, then you kind of just have to find it yourself, although this is where using proper indentation will save you a lot of time. Sublime Text and other editors will automatically indent the next line after you type an open brace, and undo the indentation on the corresponding closing brace. Following the hierarchy of indentation makes it very clear visually how far into a particular function you are. As far as I know, the standard is to indent by four spaces, and pressing the Tab key in these editors will indent that number of spaces.
I have nowhere near as much experience with this stuff as Randomity and other developers here, but I hope I was able to help explain why using a dedicated coding text editor would be very helpful to you.
- RandomityGuy
-
Hello,
I've checked your log:
You have a syntax error, upon investigating it, it seems like you have not matched the braces correctly.
Also, it's recommended to properly indent code as well as user a text editor such as VSCode or Notepad++ which have automatic brace matching capabilities so you'll know when you have missed any or added one too many.
- thearst3rd
-
Hi BRD -
This change should be relatively simple to make. Check out this snippet from the code you attached:
(PlayMissionGui.gui, line 650)
What this is doing is taking several fields out of the "mission" object (where "mission" is just a name for a level), and its using those values to fill up some text. If you want to add an author to that text, you can check if there is an "artist" inside the mission. Some of the levels in MBG already have that, like you can see if you open up the file for Learning to Roll (movement.mis):
To make use of that artist value, you can write "%mission.artist", and it will get whatever the artist is. Then, you can write that artist into the code. So, maybe it will look something like this:
The new code is what starts with "if(%mission.artist)", and it will take the artist value from the mission and put it into the description.
Hopefully this code example will help!