Jump to content
The Dark Mod Forums

Recommended Posts

Posted

In my wip I will have upto 10 security camera's, I have built a little security monitor and via a button, I would like to cycle/toggle the view between the camera's.

Amadeus suggested a 'trigger_sequencer', so I pointed the CameraGUI at this via cameraTarget arg and all that happens is the view is the 'trigger_sequencer' sees, which is obviously not what I want. The wiki dosent appear to have an article for this.

Any help or suggestions would be welcome.

bhm_banner.jpg

Posted
37 minutes ago, Wellingtoncrab said:

I may be mistaken, but I could have sworn their was prefab in core for a camera with exactly this setup where the screen has buttons to switch between the different camera feeds.

I thought so too, this wiki article (https://wiki.thedarkmod.com/index.php?title=Security_Camera_(legacy)) has camerawiki.pk4, but that test map only has controls to turn to turn the camera on/off, sweep on/of, the light on/off and a 4 button call player but dosen't seem to do anything.

It also direction mentions having more than one camera, but it seems to inly refer to have more than one display, which isnt not what I am tryng to do -

image.thumb.png.724967672e84c726961d71dfc61537f8.png

Coming at this from another angle. We have a func_static, with the camerGUI textire. It has the arg "cameraTarget" "camera1" and I would like to change it to "camera2, 3, 4 upto 10 each time a button is pressed.

bhm_banner.jpg

Posted

I did this exact thing in The Lieutenant 3. Have a look at the map script it's all handled there. I think I used camera guis layered on top of each other and switched them on/off.

https://github.com/FrostSalamander/lt3/blob/main/maps/lt3.script

  • Like 2

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions:

With Kerry000: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs A Reciprocal Gambit

Posted
19 hours ago, Frost_Salamander said:

I did this exact thing in The Lieutenant 3. Have a look at the map script it's all handled there. I think I used camera guis layered on top of each other and switched them on/off.

https://github.com/FrostSalamander/lt3/blob/main/maps/lt3.script

Noice! thank you.

bhm_banner.jpg

Posted (edited)
5 hours ago, Bikerdude said:

And I'm getting an error in the script - 

Ik quickly asked Gemini, the free google AI:

 

This looks like a script for the Doom 3 / id Tech 4 engine (or a derivative mod like The Dark Mod), given the use of sys.getEntity, spawnarg terminology, and specific camera state integers.
There are two critical logical errors and one undefined variable bug in this script that will cause it to break or fail to compile.
Here are the fixes you need to make:
## 1. Define the Global or Local State Variable
In cycleCameras(), you use currentCamera to store the active camera number, but it is never declared. If multiple functions need it, it should be defined at the top of the script.
## 2. Fix the Camera Power-On Logic Loop
In toggleCameras(), when poweredOff is true, the script turns the camera entity on and checks if ( startsHidden(screen) ) { screen.hide(); }.

* The Bug: By default, when a map loads, hidden screens are already hidden. If you turn the system off and then back on, the script hides the screens that should be hidden, but it never calls screen.show() on the one screen that is supposed to be visible.
* The Result: Activating power turns the cameras on, but all screens remain black/hidden.

## 3. Fix the "All Screens Showing" Misconception
Your areAllScreensShowing() function assumes that when the cameras are powered on, screen.isHidden() will return false for all screens. In id Tech 4, using camera.On() or camera.Off() affects the camera feed entity, but it does not automatically alter the spatial .hide() or .show() status of the screen brush/model itself.
------------------------------
## Optimized & Corrected Script
Here is the corrected version of your script with the bugs fixed:

/////////////////////////////////////////////////////////////////////////////////////////////////////// SECURITY CAMERA CODE//////////////////////////////////////////////////////////////////////////////////////////////////////
string TARGET_CAMERAS = "target_callscriptfunction_camera_cycle";string TARGET_CAMERA_POWER = "target_callscriptfunction_camera_power";
// FIX 1: Declare the tracking variable globally so the engine registers itfloat currentCamera = 1; 
boolean startsHidden(entity e)
{
	return ( e.getIntKey("hide") == 1 );
}
boolean areCamerasOff()
{
	float i;
	entity cameraTarget = sys.getEntity(TARGET_CAMERAS);

	for(i = 0; i  numberOfCameras )
	{
		nextCamera = 1;
	}

	// Show the next screen in the sequence
	for(i = 0; i < numberOfCameras; i++)
	{
		screen = cameraTarget.getTarget(i);
		float sequence = screen.getIntKey("sequence");

		if (sequence == nextCamera)
		{
			screen.show();
			currentCamera = nextCamera; // Update tracking state
			return;
		}
	}
}

## What changed?

* Removed the problematic areAllScreensShowing() function entirely, streamlining cycleCameras().
* Added screen.show() to toggleCameras() so the primary screen actually renders when you turn the power back on.
* Added screen.hide() to the power-off sequence to guarantee absolutely zero performance draw while the system is offline.

What specific bug or behavior were you encountering when you ran this in your map?

It seems Gemini recognises even the scripting language, so I'm hopfull it could work, otherwise you start your own Gemini session if new errors pop up.

 

Edited by STRUNK
  • Thanks 1
Posted (edited)

Thank you fella, but I'm not a fan of anything LLM/ML related for a number of reasons. LLM's & ML in general hallucinates or just pulls shit out of its digitaly-ass way to much of any use imho. So I'll wait for @Frost_Salamander (the person who created the original script) or another community member.  

Edited by Bikerdude

bhm_banner.jpg

Posted (edited)
4 hours ago, STRUNK said:

Ik quickly asked Gemini, the free google AI:

 

This looks like a script for the Doom 3 / id Tech 4 engine (or a derivative mod like The Dark Mod), given the use of sys.getEntity, spawnarg terminology, and specific camera state integers.
There are two critical logical errors and one undefined variable bug in this script that will cause it to break or fail to compile.
Here are the fixes you need to make:
## 1. Define the Global or Local State Variable
In cycleCameras(), you use currentCamera to store the active camera number, but it is never declared. If multiple functions need it, it should be defined at the top of the script.
## 2. Fix the Camera Power-On Logic Loop
In toggleCameras(), when poweredOff is true, the script turns the camera entity on and checks if ( startsHidden(screen) ) { screen.hide(); }.

* The Bug: By default, when a map loads, hidden screens are already hidden. If you turn the system off and then back on, the script hides the screens that should be hidden, but it never calls screen.show() on the one screen that is supposed to be visible.
* The Result: Activating power turns the cameras on, but all screens remain black/hidden.

## 3. Fix the "All Screens Showing" Misconception
Your areAllScreensShowing() function assumes that when the cameras are powered on, screen.isHidden() will return false for all screens. In id Tech 4, using camera.On() or camera.Off() affects the camera feed entity, but it does not automatically alter the spatial .hide() or .show() status of the screen brush/model itself.
------------------------------
## Optimized & Corrected Script
Here is the corrected version of your script with the bugs fixed:

/////////////////////////////////////////////////////////////////////////////////////////////////////// SECURITY CAMERA CODE//////////////////////////////////////////////////////////////////////////////////////////////////////
string TARGET_CAMERAS = "target_callscriptfunction_camera_cycle";string TARGET_CAMERA_POWER = "target_callscriptfunction_camera_power";
// FIX 1: Declare the tracking variable globally so the engine registers itfloat currentCamera = 1; 
boolean startsHidden(entity e)
{
	return ( e.getIntKey("hide") == 1 );
}
boolean areCamerasOff()
{
	float i;
	entity cameraTarget = sys.getEntity(TARGET_CAMERAS);

	for(i = 0; i  numberOfCameras )
	{
		nextCamera = 1;
	}

	// Show the next screen in the sequence
	for(i = 0; i < numberOfCameras; i++)
	{
		screen = cameraTarget.getTarget(i);
		float sequence = screen.getIntKey("sequence");

		if (sequence == nextCamera)
		{
			screen.show();
			currentCamera = nextCamera; // Update tracking state
			return;
		}
	}
}

## What changed?

* Removed the problematic areAllScreensShowing() function entirely, streamlining cycleCameras().
* Added screen.show() to toggleCameras() so the primary screen actually renders when you turn the power back on.
* Added screen.hide() to the power-off sequence to guarantee absolutely zero performance draw while the system is offline.

What specific bug or behavior were you encountering when you ran this in your map?

It seems Gemini recognises even the scripting language, so I'm hopfull it could work, otherwise you start your own Gemini session if new errors pop up.

 

I only skimmed over that, but the AI did one thing I also did. I removed the same function; not sure if it's for the same reason, but I deemed it unnecessary, too. 

Edited by Baal
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • taaaki

      The post editor for the dark themes should be working again. Apologies for the inconvenience.
      · 1 reply
    • jaxa

      Talk GabeCube:
      https://forums.thedarkmod.com/index.php?/topic/18055-2016-cpugpu-news/page/39/#findComment-508710
      · 3 replies
    • The Black Arrow

      Things have been so bad these days for me...
      Just a year ago, I've been feeling dizzy, I thought it was nothing, today's stress, that type of thing, went to sleep...Still dizzy! 9 more days dizzy, went to doctor (I would have gone on the first day if NOT for the long appointment time)
      Said it may be Neck Dizziness...I did exercises for 6 months, no changes.
      Went to a Physical Therapist, went to another, no changes.
      I've asked my doctor for a full check this time.
      I hated yesteryear so much due to personal reasons, this year might be the same.
      To be brutally honest, I'd rather have cancer or/and chronic pain than suffer dizziness any second longer, especially when nothing helps.
      Hard to enjoy Thief when you're dizzy so I was hoping this year, Winter will be best for me.
      · 7 replies
    • JackFarmer

      Hello mappers and taffers! 

      Are you still out there? It is so calm here these days and I am afraid this is no good sign.
      Proof me wrong, tell your best friend (=me), that you are still here and that you will not go away!
      · 7 replies
    • JackFarmer

      Happy Labour Day, my taffing taffers & hard working mapping friends!
      And remember the poor souls who, within the Inventors’ organization, labor under Jonus’s yoke to ensure the success of that very guild! Always remember the hard workers!
      · 2 replies
×
×
  • Create New...