Quote Originally Posted by IDTstudent View Post
Hi all! I'm developing a medical terminology game for class. It's a point-and-click adventure game where the player has to search the hospital for hidden terms, and once they've found all the terms in a level, they can advance. There are trackers in the top right-hand corner that display 1.) the level #, 2.) the rooms completed [RoomsComp], and 3.) # of terms collected [TermCounter]. The issue is that I have 5 different background images, and therefore 5 different layouts with trackers (Level, RoomsComp, & TermCounter). Because of this, I have to reference all iterations of the tracker throughout.

For example, this is the code that runs when a player clicks on an invisible shape in a room that contains a hidden term:

Sub FOUNDT1()
If T1.Caption = 0 Then
    T1.Caption = (T1.Caption) + 1
    TermCounter.Caption = (TermCounter.Caption) + 1
    SlideLayout56.TermCounter.Caption = (TermCounter.Caption)
    SlideLayout55.TermCounter.Caption = (SlideLayout56.TermCounter.Caption)
    SlideLayout57.TermCounter.Caption = (SlideLayout56.TermCounter.Caption)
    SlideLayout59.TermCounter.Caption = (SlideLayout56.TermCounter.Caption)
    If (T2.Caption) + (T3.Caption) + 1 = 3 Then
        RoomsComp.Caption = (RoomsComp.Caption) + 1
        SlideLayout56.RoomsComp.Caption = (RoomsComp.Caption)
        SlideLayout55.RoomsComp.Caption = (SlideLayout56.RoomsComp.Caption)
        SlideLayout57.RoomsComp.Caption = (SlideLayout56.RoomsComp.Caption)
        SlideLayout59.RoomsComp.Caption = (SlideLayout56.RoomsComp.Caption)
    Else
    ActivePresentation.SlideShowWindow.View.GotoSlide (30)
    End If
Else
ActivePresentation.SlideShowWindow.View.GotoSlide (31)
End If
End Sub
Q1: So the code for the TermCounter works, but I'm wondering--is there a way that "TermCounter" could apply to all iterations of the TermCounter label throughout the game? (My professor mentioned global variables being a potential solution?)
Q2: The RoomsComp does not currently work. In this level, there are 2 rooms, each with 3 terms hidden in them. Do you all see any issues with the code here? If so, how should I rewrite it?

Thanks so much! I'm also happy to upload the game if that would help!
hello,
Q1: To apply "TermCounter" globally, use global variables. Define `global TermCounter` in your function to ensure it's accessible across all iterations. This allows consistent tracking throughout the game.

Q2: Check for issues in `RoomsComp` code, such as incorrect term references or room logic errors. Ensure each room's term count is correctly updated. Rewrite the code to properly handle term identification and room boundaries.