Pursuing Tom Ram

Game available in Itch.io.

Soruce code in Github.

Programming adventures in VIC-20.


Chains

I use chains a lot, for example implementing Examine, or PUt verbs.

Remember EXamine. I player uses the verb with different objects in different locations it may print a different message.

So what I do is to test the first set of conditions. If one of the conditions is nor true, then I move to check another different set of conditions. That is why I call this a chain.

Here you have another example with the verb PUt.

  
;----------------

P_Done
        lda #str_done
        jsr PRTSTR
        rts

Put_No_Carried
        jmp Ex_No_Carried


Put_CMD
        ; Check name is in the inventory
        ; of the player
        ldx name_index
        jsr Item_In_Inventory
        bne Put_No_Carried

        ; -- Put Leaf in Bed

        ; Name is LEaf
        ldx name_index
        cpx #LEAF_IND
        bne @Next_Put_1

        ; Loc is beedroom
        lda loc
        cmp #LOC_BEDROOM
        bne @Next_Put_1

        dex
        lda #LOC_DESTROYED ; LOC 3D / 61 - Destroyed
        sta obj_status,x
        ; Mensaje
        jsr P_Done
        rts

@Next_Put_1
        ; -- Put CAndelebra in lounge

        ; You had the vision
        ldy #$1
        jsr read_flag_y
        beq @Next_Put_2 ; Sie s 0 no la tienes

        ; Loc is lounge
        lda loc
        cmp #LOC_LOUNGE
        bne @Next_Put_2

        ; Name is CHandelier
        ldx name_index
        cpx #CHANDELIER_IND
        bne @Next_Put_2

        ; Remove item and write 'Done'
        ; I could use status bit for destroyed items
        dex
        lda #LOC_DESTROYED ; LOC 3D / 61 - Destroyed
        sta obj_status,x

        ; Mensaje
        jsr P_Done
        rts


  

I know that this puzzle may be so easy that players try to resolve it in a more complex way.