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

    • datiswous

      So on a regular basis I try to start building something in Darkradiant but very quickly I loose interest and give up.
      I tend to
      create a room, position an ai in it (or first ai, then room, probably better) put a light in it Put some stuff in it test the room in tdm Now I had this new idea:
      Start of with a gigantic room. To skip the importance of sealing for the time being and to think broader than one room. Then just use ground without wall, just to visualise the structure of the level.  Then just use prefab walls and other elements (arches, etc.). Just building area's that aren't enclosed. I can always close them at a later point. Maybe this is all very logical from a mappers perspective, but tdm is the first game where I have done any kind of real mapping and I always stop at the start. It just takes too long to make something exciting.
      I want to build something at some point, because over time I accumulated lots of ideas.
      · 3 replies
    • MayheM

      It would be nice to have a link to the forum thread of a mission in download section, rather than having to search for it manually, like on Thief Guild.
      · 1 reply
    • taffernicus

      Anaglypta , floral and damask wallpaper look great in older homes 
      It’s rare to see anyone using “shader not found” wallpaper in their house

       
      · 0 replies
    • Ansome

      Terribly difficult juggling map designing with work, but I'm still alive and chipping away at something very special. I'm actually making a collaboration of sorts with a friend, I make the map itself and he acts as my "Chief Scope Creep Consultant" that checks in every so often to make sure this project isn't getting out of hand. It's a good system!
      · 1 reply
    • JackFarmer

      We don't need artificial intelligence; we need artistic intelligence. 
      Ralf Hütter, Kraftwerk
      · 6 replies
×
×
  • Create New...