Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Ctext Tutorial (unlimited strings and more!)
Ctext Tutorial (unlimited strings and more!)
Jan 31 2019, 4:37 pm
By: Oh_Man  

Jan 31 2019, 4:37 pm Oh_Man Post #1

Find Me On Discord (Brood War UMS Community & Staredit Network)

At last we finally have a way to be rid of what I have considered to be one of the most constraining limitations of all time - the string limit! I have been learning EUD-fu from Meoyap, creator of Outlast. This is my first time working with EUDs so I am having to learn a lot, fast. This tutorial is for those who are total newbs to EUDs like myself but also for EUD veterans who want to learn Ctext.

STEP 1
You will need the following programs in addition to your map making program:
EUDDraft
EUD Editor 2
TrigEditPlus

STEP 2
Put TrigEditPlus into your map making programs plugin folder. For me it was here: C:\Program Files (x86)\Stormcoast Fortress\ScmDraft 2\plugins

STEP 3
Open EUD Editor 2, it should look like this:


Click Settings, make sure StarExe is pointing at the Starcraft.exe and euddraft.exe is pointing at the eudraft.exe. Change language to English and I was using Starcraft version remastered. AutoCompile I left unticked.

Go File > New, and check the box that says Read CHK data. Load map is the map you are loading into the EUD program. This is the map you will be applying your EUDs to. Save map is the output map that will now have all the EUDs in it. That's the map you open in Starcraft when you're testing out the EUDs you have just put in! Picture:


EDIT: If you are using Remaster-specific terrain tiles and try to compile you will get error message "index was outside of the bounds of the array". Avoid this by unchecking the Tileset box in the above image!!!

STEP 4
Remember to save! Saving creates a file that isn't a map, it's basically saving everything you've done in the EUD Editor only. You can load it when you close EUD Editor and all your work will still be there.

STEP 5
Click the TriggerEditor button. You will be brought to a new screen. Down the bottom there are two tabs, classic view and advance view - switch to advance view! Your screen should now look like this:

STEP 6
As you know with triggers they're broken down into three core components: Players, Conditions, Actions. What we're doing next is basically creating those three things here in EUD Editor. It may look slightly different but it's that same three piece breakdown you're all familiar with!

First, right click "beforeTriggerExec" and click New -> For. It will look like this:

This is Players! Click Player Loop and then, for this example, we're going to use Player 1. Now it will look like this:

Click okay and you will now notice on the left of beforeTriggerExec there is a plus symbol. Click it. Now it will look like this:

STEP 7
Right click Action and go New -> If. This will create a plus symbol next to the word Action. Click it. Now it will look like this:

If and then is just fancy programmer talk for condition and action! Right click if: And and go New -> Condition. Now you'll see a screen like this:

Now we're back in familiar territory! You'll notice all the conditions from good old fashioned regular mapping. For this example we'll keep it simple with "Always" and press Ok!

STEP 8
Now, we're 8 steps in my newbs but this is what we've all been waiting for. Right click then and go New -> Action. Here's what you should see:

There are four tabs. Click Custom. There will be a drop down menu that says RawCode. Click that dropdown menu and let's start with DisplayCText. Your screen should now look like this:

Click Edit and you'll see something that looks pretty familiar and is something I wish SCMDraft had! Type in whatever you want and it should look something like this:

Now, any text you are writing here - doesn't use strings! So using appropriate condition use tying into your map's triggers you can run all your text through here! Get ready for Skyrim levels of text in SEN's upcoming maps!!

Before we leave this screen I should point out another handy feature, the Add button. Oh yeah that reminds me, as you will see the words cancel and ok are swapped around - an error on the program creator's part! Cancel actually means Ok and Ok means cancel!

Now, click the add button and you'll see this:

Basically these are handy little displays. For instance if you click Player Deaths it will create a little bit of code: {P1_D_0} but when actually playing the game it will instead show you how many deaths that player has received for X unit. So yeah, handy!

Anyway, we're still not done so type in whatever text and press "Cancel" (actually Okay). Now before pressing okay a second time click 1. DisplayOption. You'll see three options, Default, Keep Chatting and Empty. Change it to Keep Chatting so the text constantly displays! Now press Okay.

STEP 9
You don't have to save anything in here if you don't want, but you can if you want to. It will save ANOTHER separate file that contains the triggers you just made. Now close the TriggerEditor. Once you're back at the root menu, don't forget to save! Now, one thing before we are ready to test, and that is you should know the triggers created in TriggerEditor are all preserved! That means they'll loop continuously. You will need to manage your conditions appropriately if you don't want this to happen.

Now, click the Insert button. This will create another window called Log with the word "compile..." in it. That's right, it's compiling everything you've just done and creating that new map file you did at the start! You will hear a little tune play if it compiled successfully. If not, you'll get some sort of error message. If you get an error message, well, you're screwed! Don't ask me for help because if you were following these instructions it should have worked! If you were using a fresh empty map for testing purposes you should have no problems. I ran into errors myself when trying out my RPG The Architect. I think something to do with WINMPQ must have made EUD Editor not like it!

Anyway, go run your map, and hopefully you should see your text come up. Congrats! You now have the ability to create infinite strings!

STEP 10
But wait, there's more. It's time I showed you another cool feature with CText. Let's get back into the TriggerEditor. Everything you did should still be there. Good. Right click "then" and go New -> Action. Click Custom, and change the drop down menu to ChatAnnouncement. Click edit. You'll see it is identical to the Ctext screen.

This is another interesting feature with Ctext. Here you can modify what the Koreans call the mythical "13th line" (shouldn't it be called the 12th line? Eh, don't ask me). This is the line that shows you errors like when you "don't have enough minerals" etc. This is a special line with unique properties because it cannot be bumped off the screen with player chat or other display text messages. It can always stay there and that comes in handy. Remember how I showed you Add before? Here you can use that feature to have permanent displays to track things like kills, resources, deaths, etc. Go ahead and give it a whirl! Remember that the cancel and ok buttons are the wrong way round!



Notice how my message is above the line? There you go. There's one more thing you should know about line13, and that is that it can only be centred or right aligned, it can't be left aligned! It also is preserved and so will constantly stay on the screen unless you shut if off manually via your conditions.

STEP 11
Lastly there are three more actions I want to touch on briefly. MakeCText, AddCText, and DisplaySavedCText. The functionality of these actions are the ability to have two separate display text messages on a single line. For instance, let's say I wanted to show how much gold my player had, and gold was tracked via a death counter, I would go MakeCText: "Gold:" AddCText: "X", with X being the amount of gold based on the death counter, and then DisplaySavedCText would show "Gold: X". I myself haven't used this feature yet but that's how I'm told it works.

SUMMARY
So now you should know how to use Ctext with infinite strings and use the 13th line. I have one last word of warning and that is go look at the map you have just compiled and compare it to the non-EUD version - you will see the file size has jumped up! The Trigger Editor can use up quite a lot of resources and if you put enough triggers in there you will begin to get god awful map lag and giant file size and your map will become unplayable, so remember, use Trigger Editor sparingly! And by sparingly I mean if you can do a trigger inside SCMDraft or CHKDraft or whichever editor you're using, then do that! Only use the EUD Trigger Editor for EUDs! It may be a headspin connecting the triggers from your 'vanilla' map into your EUD triggers but that's a skill you'll have to master to be able to use Ctext effectively!

Lastly, I want to leave you with a screenshot demonstrating some advanced Ctext skills:




It may be hard to wrap your head around at this early stage but what is basically happening here is mostly an aesthetic use of the 13th line. It's a countdown timer counting down when a player will respawn (16.1 seconds to go mate), and the green lines are gradually becoming white ("moving" closer to the centre) which is a visual aid representing the time ticking down. Pretty cool!

I hope this tutorial was helpful to you. If you have any cool ideas for applications of Ctext or further tips about how to use Ctext then feel free to post below. Oh_Man - out!

Post has been edited 5 time(s), last time on May 27 2021, 2:41 pm by Oh_Man.




Jan 31 2019, 6:32 pm Wormer Post #2



Oh, man! Thank you for covering this topic! This is a useful one. Maybe the line is called 13th not 12th because there is actually an array of 13 strings in memory, 12 being unused and 13 being that additional string.

EDIT:
Figured out how ctext works after trying this. Fairly straightforward actually. There is a value @0x00640B58 that specifies what is the next line# to show on screen. This value is getting saved in a variable before ctext displays and getting restored afterwards. But SC still keeps top several lines for that text, that keeps a smaller window for chatting.

I didn't find any difference between default and empty display. What kind of difference there supposed to be, anyone?

Post has been edited 3 time(s), last time on Jan 31 2019, 10:21 pm by Wormer.



Some.

Feb 1 2019, 10:18 am Arta(M) Post #3

Armoha

Quote
I have one last word of warning and that is go look at the map you have just compiled and compare it to the non-EUD version - you will see the file size has jumped up! The Trigger Editor can use up quite a lot of resources and if you put enough triggers in there you will begin to get god awful map lag and giant file size and your map will become unplayable, so remember, use Trigger Editor sparingly!
euddraft uses up lots of resources as an initial setup, but in reality as reusing trigger is possible in euddraft, it takes much less map size for bigger project.

Quote
Here you can modify what the Koreans call the mythical "13th line" (shouldn't it be called the 12th line? Eh, don't ask me).
It is called "13th line", because there is a "12th line", beneath the resources display. Currently in SC:R, we can't use "12th line" as there is no way to display any text to be overwritten, as opposed to "13th line" which knowingly invokes Cannot Create More Unit error and overwrite the error message.




maintainer of euddraft and eudplib.
Armo#6637 at Discord :teehee:

Feb 9 2019, 11:16 pm Ultraviolet Post #4



This is great, thanks for posting! I am confused about one detail though.. What are we using TrigEditPlus for?




Feb 18 2019, 8:23 am Swampfox Post #5



Quote
The Trigger Editor can use up quite a lot of resources and if you put enough triggers in there you will begin to get god awful map lag and giant file size and your map will become unplayable, so remember, use Trigger Editor sparingly!
I would assume nesting if/then statements won't actually keep down on the lag because it's being emulated by triggers, right? It's tempting to do some crazy cool stuff in there.



None.

Feb 27 2019, 5:37 pm MinuteMan Post #6



Quote from Swampfox
Quote
The Trigger Editor can use up quite a lot of resources and if you put enough triggers in there you will begin to get god awful map lag and giant file size and your map will become unplayable, so remember, use Trigger Editor sparingly!
I would assume nesting if/then statements won't actually keep down on the lag because it's being emulated by triggers, right? It's tempting to do some crazy cool stuff in there.

It should be noted that the resource usage mentioned is in regards to using classic triggers. Utilizing the onPluginStart/beforeTriggerExec/afterTriggerExec is much more resource friendly. I will include some advanced tutorials for some of this in my Tutorials post: http://www.staredit.net/topic/17753/




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
Please log in to shout.


Members Online: jun3hong, Revenant