Ignore input in select rooms?

mAnthon

New member
How can I tell the game to ignore an input when I'm in certain rooms? I'm using the maze module, and the controls are set to the standard up, down, left, and right all move in those directions. But if I'm in certain rooms, I would like Up and Down to not do anything. The character should just move left and right. How can I do this?

For example, I would like Down to be disabled when I'm in screen 100, screen 104, and screen 106. What could I add to the input script to say --

If in Screen 100, Screen 104, or Screen 106
Do Nothing


Else do all the normal script below.
 

Mugi

Member
add the following to the beginning of your input scripts

Code:
	LDA newScreen
	CMP #$01	; room number here 
	BNE +	
	RTS
+

what this does is checks the screen number you're entering during the transition between rooms.
if the room number matches the defined one, the script will just terminate
 

mAnthon

New member
Thank you. Does that work with multiple rooms too? For my original example where I need it disabled for 3 screens, would I enter it like this?

Code:
	LDA newScreen
	CMP #$100	; room number here 
	CMP #$104	; room number here 
	CMP #$106	; room number here 
	BNE +	
	RTS
+
 

Mugi

Member
it would be,

Code:
	LDA newScreen
	CMP #$64	; room number here 
	BNE +	
	CMP #$68	; room number here 
	BNE +	
	CMP #$6A	; room number here 
	BNE +	
	RTS
+


you will have to add the BNE (branch if not equal) after every room number, othervise the code only checks the last entry.
also, note that the value is written as a hex number instead of decimal (100=64, 104=68 and 106=6A)
 

Mugi

Member
newscreen is the room that is defined to be the destination to warp to, so it can be used to identify which screen you currently are in.
alternatively there is a variable called currentScreen, but i stopped using it for some reason, so it propably returns crap data under certain conditions, i dont really remember anymore.
 

Razzie.P

Member
FormulaFanboy said:
How do you know what the room number is?

If I understanding what you're asking -- you'd just count the rooms, left to right starting at 0. For example, the first room, 0,0 would be room 0, the one below it (0,1) would be room 16. Below that (0,2) would be 32, etc etc. You can then use the binary to hex tool (under plugins) to find the value for the code that Mugi provided. Alternatively, you can set a user constant for the room and give it a name, then using that name in the code if preferred.
 
Razzie.P said:
FormulaFanboy said:
How do you know what the room number is?

If I understanding what you're asking -- you'd just count the rooms, left to right starting at 0. For example, the first room, 0,0 would be room 0, the one below it (0,1) would be room 16. Below that (0,2) would be 32, etc etc. You can then use the binary to hex tool (under plugins) to find the value for the code that Mugi provided. Alternatively, you can set a user constant for the room and give it a name, then using that name in the code if preferred.

Thank you, although it still doesn't seem to be working...
I'm trying to ignore "B" for the textbox on some select screens where a cutscene plays, I had this script just to test it out on screen 13,11 but it seems not to be working for some reason...

Code:
	LDA newScreen
	CMP #$BD	; room number here 
	BNE +	
	CMP #$68	; room number here 
	BNE +	
	CMP #$6A	; room number here 
	BNE +	
	RTS
+
    LDA textboxHandler
    AND #%00010000 ;; if the b button is pressed
                    ;; but the box + text have been activated
                    ;; and also the 'do box' bit is OFF
                    ;; that means this is ready to "go away".
                    
    BEQ checkToTurnTheTextboxOn ;; hasn't started yet
    
    ;; begin turning the textbox off.
    LDA gameHandler
    ORA #%00100000
    STA gameHandler
    ;;; are we turning this on or off?
    ;;; check for more
    ;;; check for 'choice'.
  
    LDA #$00
    STA updateNT_offset
    STA updateNT_H_offset
    STA updateNT_V_offset
    
    LDA #%10001000
    STA textboxHandler
    RTS
   
checkToTurnTheTextboxOn:  
   LDA npc_collision
    BEQ noNPCcollision
    LDA textboxHandler
    AND #%10000000
    BNE noNPCcollision
   LDA gameHandler
    ORA #%00100000
    STA gameHandler
    ;;; are we turning this on or off?
    ;;; check for more
    ;;; check for 'choice'.

turnTheTextboxOn:
  
    LDA #%10000000
    STA textboxHandler
    
noNPCcollision:
    RTS
 

dale_coop

Moderator
Staff member
If you want to skip the script when checking some screens values, it should be something like:

Code:
	LDA newScreen
	CMP #$BD	; room number here 
	BNE +	
	RTS
	+
	CMP #$68	; room number here 
	BNE +	
	RTS
	+
	CMP #$6A	; room number here 
	BNE +	
	RTS
	+
	
	;;ETC
 

dale_coop

Moderator
Staff member
Another technic could be, to set all your cutscreens to aspecific screen-type value and checking that screentype.
Code:
	LDA screenType
	CMP #99	;; if the screen type is 99, we stop the script here
	BNE +
	RTS
	+

Or a screenFlags...
 
dale_coop said:
Another technic could be, to set all your cutscreens to aspecific screen-type value and checking that screentype.
Code:
	LDA screenType
	CMP #99	;; if the screen type is 99, we stop the script here
	BNE +
	RTS
	+

Or a screenFlags...

This worked. Thank you, dale_coop! You are a living legend! :D
 
Top Bottom