How do I delete text in a scene?

Schteven1234

  • Posts: 31
Hey there, Stencylers,

  I have recently been working on a behavior for creating text boxes, and am having trouble removing and replacing text I've already drawn. I associated the spawning of the text with an attribute, hoping that when I set it to false in the future, the text would leave also. Then I wanted to add new text in the same position, yet I got into a sort of paradoxical "If condition A, then remove condition A" thing and found it hard to remove the first text set safely. Let me know if a screenshot is needed, but I pretty much restarted. I feel like I probably am missing something obvious, and maybe there is something on Stencylpedia I didn't find initially, but any help would go a long way for me. Thanks, and good luck in your own Stencyl endeavors.

Hectate

  • *
  • Posts: 4643
When Drawing; if Condition A is true; draw text.

If condition A ceases to be true, the text ceases to be drawn.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Schteven1234

  • Posts: 31
Thanks, I'll play around with it a little bit more. That essentially was my strategy, so I must not be explaining well, but all in all, thanks again for the fast and clear response!

coleislazy

  • *
  • Posts: 2607
To clarify, if you don't tell it to draw the text every update, it won't draw any. So, in Hectate's example of:
Code: [Select]
if(A == true) draw text;
if A becomes false, your text will immediately stop drawing with the next update (~10 ms).

Schteven1234

  • Posts: 31
To clarify, if you don't tell it to draw the text every update, it won't draw any.

Ok, thanks for the clarification! But how would I get the text to update every frame on a "when drawing" block? Sorry if this is an obvious question, but I did try to look for such a block (if any).

Schteven1234

  • Posts: 31
And maybe I'd better show what I'm doing:


rob1221

  • *
  • Posts: 9421
You shouldn't check for user input under "when created".

Schteven1234

  • Posts: 31
Ok, I put it under a "when key is pressed" block, thanks. Still not working though!

rob1221

  • *
  • Posts: 9421
Use printing or drawing to confirm those booleans are the right values.

Schteven1234

  • Posts: 31
Sorry, not exactly sure what you mean. I am pretty sure the booleans are lined up right, though. I feel super lost here, and I'm sorry to be annoying! Maybe I should find another way of figuring it out instead of spamming. I will update the thread when I get something, though.

rob1221

  • *
  • Posts: 9421
Just put the boolean attributes themselves in draw text blocks so you can see their values at all times.

Schteven1234

  • Posts: 31
Ok, I've been slaving over a hot computer for a while here, and I haven't exactly fixed my problem. But I have made lots of progress, and while I don't want to mark this "solved," I will try and share what I figured out (probably nothing new for most, but still, it could help).

1.
When Drawing; if Condition A is true; draw text.

If condition A ceases to be true, the text ceases to be drawn.

Totally true. Attributes will make their triggered results stay only as long as the attributes are true or equal or whatever, while I do believe some lone blocks will create results that are pseudopermanent, such as "create actor type."

2. If using the same button to delete text (through setting booleans and the like to "false" or  however you do it) as you are using to spawn new text, you may want to consider adding a "do after x seconds" somewhere along the belt to give separation between the commands. This will help keep the updating process away from spawning and deleting text at the same time repeatedly. I attached an example of my system. Note that "x" doesn't have to be long.

3. Don't be afraid to get stuff off StencylForge. Lots of useful behaviors and such with modest requirements for commercial use.

And finally, thanks to Hectate, coleislazy, and rob1221 for their fast assistance and generosity. Please feel free to let me know if I included erroneous information, anyone.