Modified Autotext Tile

Bucket Mouse
Posts: 193
Joined: Wed Mar 07, 2018 2:25 am

Modified Autotext Tile

Post by Bucket Mouse » Mon Sep 17, 2018 4:28 am

As it is, the Autotext tile status works just once when you stand on it, and not again -- as it should. However, if you leave the screen, it will activate again.

There are times when you don't want it to do this. Therefore I've added something to it that responds to a trigger.

Code: Select all

	CPX player1_object
	BNE finishedWithAutoText

	lda screenType ;; this is the value of the screen to change.
		AND #%00000111 ;; look at last bits to know what bit to check, 0-7
		TAX
		LDA ValToBitTable_inverse,x
		STA temp
	lda screenType
	
		LSR
		LSR
		LSR 
		;;; now we have the right *byte* out of the 32 needed for 256 screen bytes
		TAY
		LDA screenTriggers,y ;; now the rigth bit is loaded into the accum
		AND temp
		BNE finishedWithAutoText	

	JSR GetTileAtPosition
	LDA collisionTable,y		;<<-- check the current tile collision data
	BEQ finishedWithAutoText
	
	ChangeTileAtCollision #$00, underSecret  ;<<-- change the collision data of the current tile to null walkable and graphics to undersecret
	
	LDA #$01
	STA textBoxFlag
	JSR dodrawTextBox
	
finishedWithAutoText:
If you want to eliminate the text box effects from the screen permanently after one use, make your text set off a trigger. Now, when you return to the triggered screen, that text will no longer appear.

if you DON'T want this, just don't use a trigger on that screen. Or use the original unmodified version below:

Code: Select all

CPX player1_object  ;; check if it is the player (not a monster)
	BNE finishedWithAutoText
	
	ChangeTileAtCollision #$00, underSecret
	LDA #$01
	STA textBoxFlag
	JSR dodrawTextBox
	
finishedWithAutoText:
	;;RTS
Last edited by Bucket Mouse on Mon Nov 05, 2018 2:46 am, edited 8 times in total.
User avatar
PortableAnswers
Posts: 56
Joined: Wed May 02, 2018 11:52 am
Location: USA
Contact:

Re: Modified Autotext Tile

Post by PortableAnswers » Thu Sep 20, 2018 2:43 pm

Would you be able to make a video for how to use this?
Bucket Mouse
Posts: 193
Joined: Wed Mar 07, 2018 2:25 am

Re: Modified Autotext Tile

Post by Bucket Mouse » Thu Sep 20, 2018 8:55 pm

I don't think we need a video. Take the script, copy it into Notepad and save it in GameEngineData/Routines/UserScripts/AdventureGame_Base/TileScripts as "Autotext.asm"

Then open NESmaker, go to Project Settings / Script settings and import the ASM, then use the "Change" button on the menu to assign it to one of the blank Tile Types.

Switch to the Project Labels tab and rename that Tile Type to "Autotext."

Now on any Overworld or Underworld screen, you can right-click and change the status of whatever tile you choose. Autotext will always bring up the first text in the assigned Text Group for that screen.
darkhog
Posts: 256
Joined: Sun May 13, 2018 10:02 am

Re: Modified Autotext Tile

Post by darkhog » Sun Sep 30, 2018 10:16 pm

Hey, it doesn't work for me. And by doesn't work I mean game is stuck in infinite loop displaying the box over and over again.

//edit: Platform module, 4.0.11

//edit #2: Fixed it:

Code: Select all

;; CHANGE to a "0 - Walkable" special Tile "UnderSecret"

	LDA screenType
		;; divide by 32
		LSR
		LSR
		LSR
		;LSR
		;LSR
		;;; now we have the right *byte* out of the 32 needed for 256 screen bytes
		TAY
		LDA screenTriggers,y ;; now the rigth bit is loaded into the accum
		STA temp
		LDA screenType
		AND #%00000111 ;; look at last bits to know what bit to check, 0-7
		TAX
		LDA ValToBitTable_inverse,x
		AND temp
		BNE finishedWithAutoText

	CPX player1_object  ;; check if it is the player (not a monster)
	BNE finishedWithAutoText
  JSR GetTileAtPosition
  LDA collisionTable,y
	BEQ finishedWithAutoText ;;already tripped.
	LDA #$01
	STA textBoxFlag
	JSR dodrawTextBox
  ChangeTileAtCollision #$00, underSecret
finishedWithAutoText:
	;;RTS
Checkpoint tile helped me.
Bucket Mouse
Posts: 193
Joined: Wed Mar 07, 2018 2:25 am

Re: Modified Autotext Tile

Post by Bucket Mouse » Mon Oct 01, 2018 6:06 am

I'm on 4.0.6. What has to be changed specifically in the later build, and why?

(I'll probably be asking this again later this week when the next build hits...)
User avatar
dale_coop
Posts: 1593
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Modified Autotext Tile

Post by dale_coop » Mon Oct 01, 2018 7:34 am

Agree with darhog, checking the tile (with the "GetTileAtPosition") before continuing, prevents a looping issue (got it too).
And I think you could clean up the code, for the triggering part, using a macro

Code: Select all

  TriggerScreen screenType
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
darkhog
Posts: 256
Joined: Sun May 13, 2018 10:02 am

Re: Modified Autotext Tile

Post by darkhog » Sun Oct 07, 2018 9:55 pm

Found another bug - if the monster walks into the tile, it activates anyway. Not sure how to fix that one though.
User avatar
dale_coop
Posts: 1593
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Modified Autotext Tile

Post by dale_coop » Mon Oct 08, 2018 6:04 am

Try loving the lines:

Code: Select all

    CPX player1_object  ;; check if it is the player (not a monster)
    BNE finishedWithAutoText
To the beginning of the script.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
DanielT1985
Posts: 61
Joined: Sat Sep 01, 2018 7:44 pm

Re: Modified Autotext Tile

Post by DanielT1985 » Tue Oct 09, 2018 3:07 am

The "Only working once when in screen and refreshing screen making it work again" thing is actually gonna be useful for me. Thank you so much for creating this.
User avatar
DanielT1985
Posts: 61
Joined: Sat Sep 01, 2018 7:44 pm

Re: Modified Autotext Tile

Post by DanielT1985 » Tue Oct 09, 2018 3:14 am

Oh, and also, I have an opening-text cutscene and had to use 2 screens because of another different text tile keeping me on loop if I don't get off of it, and the only way to do that was to have the player spawn on both at the same time, which also caused the beginning piece of dialogue to disappear. With this, I just spawn the person on the NPC tiles, they turn into background tiles, and the character falls onto the warp tiles AND keep the beginning piece of dialogue on the SAME screen. This actually saved me a screen.
Post Reply