[Resolved] (4.5.9 MetroVania) How to dismiss textbox, make text go away ?

Hello, I can get the box to show but there is no text inside.
The code is in a pickup, I am trying to show text when the pickup is collected.
Here is a video of what is happening,

View: https://www.youtube.com/watch?v=vmZqDTDBs7M


And here is the code of the pickup.

LDA Object_type,x
CMP #$08 ; #$08 is Energy Tank
BNE +notThisPickup
LDA myMaxHealth
CLC
ADC #4
STA myMaxHealth
STA myHealth
LDA #$00
STA npc_text
TriggerScreen screenType
JMP endPickups

+notThisPickup
CMP #$07 ; #$07 is Plasma Tank
BNE +notThisPickup2
LDA myMaxAmmo
CLC
ADC #10
STA myMaxAmmo
STA myAmmo
LDA #$01
STA npc_text
TriggerScreen screenType
JMP endPickups

+notThisPickup2

endPickups:
DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH, #BOX_1_HEIGHT, #TEXT_NPC, npc_text
 
I got the text to show, it was a silly mistake, I had the screen tiles as Main main no hud.
But I still can not get the textbox to finish and go away.
How can I get the text box to go away by pressing a button ?
 

Logana

Well-known member
You will have to add the code from the adventure module that starts text, it’s sorta weird as it’s how to start and end a text diolog stream but that’s how it works, and assign that to the a button @Francois Brodeur
 
Hi Logana, thank you for taking the time to help me.
I have put the script: drawNPCtext_AdventureBase in my input and assigned it to the A button but it does not make the textbox go away.
 

Logana

Well-known member
I think the issue may be that the coded is constantly drawing the text every frame that the player is in collision with the tile as that's how nesmaker deals with tiles, Im not sure how to fix it, but after taking a longer look into the code it seems to be the issue
 
Success !
The DrawBox Macro is the line of code that close the textbox.
I have made a textBox variable that I increase when I show a textbox and in my input I have this code that will decrease the variable back to 0 and close the textbox.

LDA #$00
CMP textBox
BEQ +skipNpcText
DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH , #BOX_1_HEIGHT, #TEXT_NPC, npc_text
DEC textBox

+skipNpcText
RTS
 

Kanbei85

Member
Success !
The DrawBox Macro is the line of code that close the textbox.
I have made a textBox variable that I increase when I show a textbox and in my input I have this code that will decrease the variable back to 0 and close the textbox.

LDA #$00
CMP textBox
BEQ +skipNpcText
DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH , #BOX_1_HEIGHT, #TEXT_NPC, npc_text
DEC textBox

+skipNpcText
RTS

Does the npc_text variable represent which one of the four NPC text group items (00 - 03) you trigger?
 

IMBrendan

Member
From what I can tell from the code the npc_text variable is set based on the weapon picked up, it then displays the appropriate text string for that item - Kanbei85

Success !
The DrawBox Macro is the line of code that close the textbox.
I have made a textBox variable that I increase when I show a textbox and in my input I have this code that will decrease the variable back to 0 and close the textbox.

LDA #$00
CMP textBox
BEQ +skipNpcText
DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH , #BOX_1_HEIGHT, #TEXT_NPC, npc_text
DEC textBox

+skipNpcText
RTS
I'm interested in diving deeper into your solution - where in the textbox marco did you set the increment for the textBox value? I'm adapting this idea to a scrolling met Vania story game - so I'm probably running into issues with my custom code. Currently the text still displays as normal - leaving my character playable as the text draws. The text also wont dismiss until the next text box attempts to draw. again probably custom code so I may have try this on a fresh install.
 

Kanbei85

Member
From what I can tell from the code the npc_text variable is set based on the weapon picked up, it then displays the appropriate text string for that item - Kanbei85


I'm interested in diving deeper into your solution - where in the textbox marco did you set the increment for the textBox value? I'm adapting this idea to a scrolling met Vania story game - so I'm probably running into issues with my custom code. Currently the text still displays as normal - leaving my character playable as the text draws. The text also wont dismiss until the next text box attempts to draw. again probably custom code so I may have try this on a fresh install.
I just want to be able to trigger some particular piece of text I set in the GUI by stepping on a tile. Any way to do this?
 

IMBrendan

Member
the standard instant text tile should do most of the work for you there. I think its "screentext" as the variable by default for the text set by GUI - but I'm too lazy to check. so its something like;

DrawBox #BOX_1_ORIGIN_X, #BOX_1_ORIGIN_Y, #BOX_1_WIDTH , #BOX_1_HEIGHT, #TEXT_NPC, screentext, npc_text
NOTE: I take no responsibility if this breaks your code by copy pasting it.

You can also just replace npc_text with a HEX number and it should call the text if its located in the correct bank. Lastly, some one mentioned that palette switching could be game breaking for textboxes (I forget why) so if you are having issues, the fact that you are testing a day night cycle may also cause problems.
 

Kanbei85

Member
How do I control what particular text in the GUI is going to be called by this routine? When I tried it out, it just called the first text item even though that wasn't supposed to show on that screen.
 
npc_text is the text that will be displayed.
lda #$09
sta npc_text
Will display text number 9 in the list.
I dont know how to get the text that is set in text group of the screen.

textbox is a variable that I created in zero page ram and is not part of the drawbox macro. I use it as a condition to know when a textbox has been called.
 
There is certainly a way to do it but I don't know how.
I did not experiment much with textbox aside from showing one when collecting a pickup.
 

IMBrendan

Member
Is there no way to use the GUI to specify on a screen-by-screen basis which text will be displayed with the auto-text tile, or perhaps even to specify different text for different tiles on the same screen?
Hey dude - after a lot of testing and a fresh install - I can say with some confidence that our issue is trying to do the day night cycle. It was mentioned somewhere else (lost where) that palette switching causes problems with textboxes for some unknown reason.
 

Kanbei85

Member
Hey dude - after a lot of testing and a fresh install - I can say with some confidence that our issue is trying to do the day night cycle. It was mentioned somewhere else (lost where) that palette switching causes problems with textboxes for some unknown reason.

Well the problem at the moment is that I don't even know how to choose which text is supposed to show on the screen.
 

IMBrendan

Member
I've been working on a solution to that - as I have the same problem. The key is that the draw box code is called in (at least) 2 locations that effect things differently but some how at the same time. I probably have a solution to your problem, when I get back to my computer later today I'll make a new post to explain what I've done.
 

Kanbei85

Member
I've been working on a solution to that - as I have the same problem. The key is that the draw box code is called in (at least) 2 locations that effect things differently but some how at the same time. I probably have a solution to your problem, when I get back to my computer later today I'll make a new post to explain what I've done.

Isn't it nice working as an unpaid software programmer to fix software you paid for?
 

IMBrendan

Member
I bought a dev kit with a ton of example code on how to do what I want. The fact that with my limited knowledge of programming I can use this to create my own software is pretty incredible in an of it's self. I see it the same way as if I was working on android development - I would need to upgrade and change other peoples code on github or something. At least here I have a community that is working towards doing something similarly silly.
In the end we are a bunch of people who are interested in making NES games - Sharing what we learn about assembly is part of the fun.
 

Kanbei85

Member
I bought a dev kit with a ton of example code on how to do what I want. The fact that with my limited knowledge of programming I can use this to create my own software is pretty incredible in an of it's self. I see it the same way as if I was working on android development - I would need to upgrade and change other peoples code on github or something. At least here I have a community that is working towards doing something similarly silly.
In the end we are a bunch of people who are interested in making NES games - Sharing what we learn about assembly is part of the fun.
Well, I think that's a good way to look at it :)

I know a lot more about assembly now than I did when I started (which was nothing)
 
Top Bottom