void main()
{
    object oGM = GetPCSpeaker();
    object oTrap = OBJECT_INVALID;
    object oValidTrap = OBJECT_INVALID;
    int nIndex = 0;

    // Loop through all objects with the tag "CAS_PLC_VFXTRAP"
    while (1) // Equivalent to "while (true)" in NWScript
    {
        oTrap = GetObjectByTag("CAS_PLC_VFXTRAP", nIndex);

        // If we run out of objects with this tag, break the loop
        if (!GetIsObjectValid(oTrap))
        {
            break;
        }

        // Check if the trap is in the same area as the player
        if (GetArea(oTrap) == GetArea(oGM))
        {
            oValidTrap = oTrap; // Store the first valid trap found
            break;
        }

        nIndex++; // Move to the next object with this tag
    }

    // If no valid trap was found, notify the player
    if (!GetIsObjectValid(oValidTrap))
    {
        SendMessageToPC(oGM, "No hazard found in this area.");
        return;
    }

    // Fetch data from the found trap
    int nDC = GetLocalInt(oValidTrap, "nDC");
    string sDamage = GetLocalString(oValidTrap, "sDamage");
    int nDamageType = GetLocalInt(oValidTrap, "nDamageType");
    float fFrequency = GetLocalFloat(oValidTrap, "fFrequency");

    string sMessage = "Current Hazard Settings:\n" +
                      "DC: " + IntToString(nDC) + "\n" +
                      "Damage: " + sDamage + "\n" +
                      "Damage Type: " + IntToString(nDamageType) + "\n" +
                      "Rate: Every " + FloatToString(fFrequency) + " seconds.";

    SendMessageToPC(oGM, sMessage);
}
