Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 857 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
surveillance_camera_code problem (AUM 10) #133310
06/02/07 14:55
06/02/07 14:55
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
Hallo,

I had modify the surveillance_camera_code from aum10. When the player stand in front of a monitor and press the action_key, switchs to the camaraview. (The goes fine) But i have some problems.
1) I can't swicht between cameras. ( I will switch between all cameras in the level. And from the last cameraview to the playerview.)
2) Player can move when the cameraview is on (The player should not be able to move, but can be nevertheless killed if the Camaraview is on.)

Code:
  
var cam_var = 0;

view surv_camera {}


function change_var()
{

if (key_ctrl == 1) // wird STRG gedrückt
{
if (cam_var == 1)
{
cam_var = 2;
}
if (cam_var == 2)
{
cam_var = 0;
}
}
}




action camera_switch
{
my.enable_click=ON;
my.enable_scan = ON;
//MY.enable_shoot = ON;
MY.event = camera_event;
}

function camera_event
{
cam_var=1;
}


action cam_1 // Action der 1 Camera
{
while(1)
{

if (cam_var == 1)
{
my.skill8=1;
surveillance_camera();
}
else
{
my.skill8=0;
}
wait(1);
}
}

action cam_2 // Action der 2 Camera
{
while(1)
{

if (cam_var == 2)
{
my.skill8=1;
surveillance_camera();
}
else
{
my.skill8=0;
}
wait(1);
}
}



function surveillance_camera
{

if (my.skill1 + my.skill2 + my.skill3 + my.skill4 + my.skill5 + my.skill6 == 0) {beep; beep; return;}
// remove the camera if we forget to fill in the skills 1..6 (at least one of them)


while (1)
{
if (my.skill8 == 1) //
{

camera.visible = off; // hide the default "camera"
surv_camera.x = my.skill1; // set the new camera position and angles
surv_camera.y = my.skill2;
surv_camera.z = my.skill3;
surv_camera.pan = my.skill4;
surv_camera.tilt = my.skill5;
surv_camera.roll = my.skill6;
surv_camera.visible = on; // and make it visible

cam1_pan.visible = on;
change_var();
}
else
{
if (cam_var == 0) // now it has lost the focus and shouldn't affect the other surveillance cameras
{
surv_camera.visible = off;
camera.visible = on;
cam1_pan.visible = off;
cam2_pan.visible = off;

}
}
wait (1);
}

}





By White_Wolf

P.S. sorry for my bad englich


A8 Com Version 8.40 Win 7 64 Bit
Re: surveillance_camera_code problem (AUM 10) [Re: White_Wolf] #133311
06/04/07 13:29
06/04/07 13:29
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Quote:


if (key_ctrl == 1) // wird STRG gedrückt
{
if (cam_var == 1)
{
cam_var = 2;
}
if (cam_var == 2)
{
cam_var = 0;
}
}




you don't have what happend if cam_var = 0 so you can't back to first camera

Quote:


if (cam_var == 1)
{
my.skill8=1;
surveillance_camera();
}
else
{
my.skill8=0;
}




in this case survillance_camera function will be only working if skill8 ==1;

so this one in the camera code will not working
Quote:


while (1)
{
if (my.skill8 == 1) //
{ ........


}
else
{





and my.event = cemare_event... I don't get it? Why U using this? if you'll cheng this parameter? but still event will be working?

Last edited by tompo; 06/04/07 13:35.

Never say never.
Re: surveillance_camera_code problem (AUM 10) [Re: tompo] #133312
06/04/07 19:14
06/04/07 19:14
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
Hello,

Quote:

and my.event = cemare_event... I don't get it? Why U using this? if you'll cheng this parameter? but still event will be working?




The action camera_switch is for the monitor. When the player stand in fornt of the monitor and press the Space_key, change the camara_var to 1. So that switch to the camaraview. Do goes fine. But one of the problems is when the cameraview is on and the player press the ctrl_key (strg Taste) swichs back to the player and not to the secend camera.

By White_Wolf

P.S. Sorry for my bad english.


A8 Com Version 8.40 Win 7 64 Bit
Re: surveillance_camera_code problem (AUM 10) [Re: White_Wolf] #133313
06/04/07 20:37
06/04/07 20:37
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
You can switch between the cameras if you set their position and angles this way:

var camera_number = 1;

if (camera_number == 1) // this would be your first camera
{
surv_camera.x = ....
surv_camera.y = ....
surv_camera.z = ....
surv_camera.pan = ....
surv_camera.tilt = ....
surv_camera.roll = ....
}
if (camera_number == 2) // this would be your second camera
{
surv_camera.x = ....
surv_camera.y = ....
surv_camera.z = ....
surv_camera.pan = ....
surv_camera.tilt = ....
surv_camera.roll = ....
}
...........

Make sure to increase camera_number every time when you press the action_key. Use the % operator to set the upper limit for camera_number.

"Player can move when the cameraview is on". That's an easy fix. Add this line of code inside its movement loop:

while (surv_camera.visible) {wait (1);}

Make sure to hide surv_camera when you aren't using it.

Re: surveillance_camera_code problem (AUM 10) [Re: George] #133314
06/05/07 17:29
06/05/07 17:29
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
Helle,

I have change the code so.

Code:
 var camara_number = 0; //keine Kamera ausgewählt

view surv_camera {}

function change_camara_number
{


if (key_ctrl == 1) // wird STRG gedrückt
{
if (camara_number == 0)
{
camara_number = 1;
surveillance_camera();
}
if (camara_number == 1)
{
camara_number = 2;
surveillance_camera();
}
if (camara_number == 2)
{
camara_number = 0;
surveillance_camera();
}

}



}

action camera_switch
{
my.enable_click=ON;
my.enable_scan = ON;
//MY.enable_shoot = ON;
MY.event = camera_event;
}

function camera_event
{
camara_number=1;
surveillance_camera();
}


function surveillance_camera
{
while(1)
{

if (camara_number == 1) // this would be your first camera
{
camera.visible = off; // hide the default "camera"
surv_camera.x = 154.850; // X Wert aus Wed übertragen
surv_camera.y = 89.065; // y Wert aus Wed übertragen
surv_camera.z = -1618.563; // z Wert aus Wed übertragen
surv_camera.pan = 0; // Pan-Winkel aus wed übertragen
surv_camera.tilt = 329; // tilt-Winkel aus Wed übertragen
surv_camera.roll = 360; // roll-Winkel aus Wed übertragen
surv_camera.visible = on; // and make it visible
cam1_pan.visible = on; // Panel der Kamera
change_camara_number();
}
if (camara_number == 2) // this would be your second camera
{
surv_camera.visible = off; // alte wiew aus
surv_camera.x = 156.929;
surv_camera.y = 268.510;
surv_camera.z = -1621.874;
surv_camera.pan = 180;
surv_camera.tilt = 342;
surv_camera.roll = 0;
surv_camera.visible = on; // neue an
cam1_pan.visible = on; // Panel der Kamera
change_camara_number();
}
else
{
if (camara_number == 0) // kamerasicht deaktivieren
{
surv_camera.visible = off;
camera.visible = on;
cam1_pan.visible = off;
cam2_pan.visible = off;

}
}
wait(1);
}
}



But i have the same Problem, i can´t swich between cameras. (It swicht between camera 1 and playerview). What have i make wrong. I have shown the camera_number var and it swichts only between 0 and 1. What is mean with % operator ? (I don´t find a anwnser in the manuel (i have search operator but it get no result).

By White_Wolf

P.S. Sorry for my bad english


A8 Com Version 8.40 Win 7 64 Bit
Re: surveillance_camera_code problem (AUM 10) [Re: White_Wolf] #133315
06/06/07 09:28
06/06/07 09:28
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Quote:

Code:
 function change_camara_number
{
if (key_ctrl == 1) // wird STRG gedrückt
{





if you doing this this way it must to be inside loop

it's not working because you changing in this case camera from 0->1 1->2 2->0 in one cycle !!! so nothing will happend
Code:
 
function change_camara_number
{
if (camara_number == 0)
{
camara_number = 1; //0 -> 1 start from 0
}
if (camara_number == 1)
{
camara_number = 2; //1 -> 2
}
if (camara_number == 2)
{
camara_number = 0; //2 -> 0 end with 0
}
}
on_ctrl change_camara_number;




so better will be if You'll do it this way:
Code:
 
function change_camera
{
camera %= 3; // this is "modulo", parameter will only have value 0,1,2 (write "ugly" in help serch and you'll find this in "ugly code") ;)
camera_number += 1;
}
on_ctrl change_camera;


then...
Code:

function surveillance_camera
{
while(1)
{
if(camera_number ==1).....
if(camera_number ==2)....
wait(1)
}
}


and you have to call this function only once... f.e. in player action to avoid empty pointers.

and cut-off change_camara_number();!! in this function becouse it doesn't make sense to do it in every cycle

Last edited by tompo; 06/06/07 10:30.

Never say never.
Re: surveillance_camera_code problem (AUM 10) [Re: tompo] #133316
06/19/07 18:10
06/19/07 18:10
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
@tompo

I have testet, what you have worte in your Contribution. But It switch's only to the first camara and not to the secent and not back to the player.
So i have change the code. But nothig hapens. Why not ? (The code with the indicator == _HANDLE have a form a lamp-code whos ollow to swich on an of lampfs with a Light switch. And there goes fine.) Why goes the same not with the Camara?

Code:
 action camera_switch  	// Function für Die Überwachungsmonitor vor 
{ // den dann der Spieler Space drücken muss um Camera zua aktivieren, und zu wechseln (auch zurück zum player)
my.enable_click=ON;
my.enable_scan = ON;
//MY.enable_shoot = ON;
MY.event = camera_event;
}

function camera_event
{

if(indicator == _HANDLE) // wird duch drücken von space aufgerufen
{
if (cam_counter == 0)
{
cam_counter = 1;
surveillance_camera();
}
if (cam_counter == 1)
{
cam_counter = 2;
surveillance_camera();
}
if (cam_counter == 2)
{
cam_counter = 0;
surveillance_camera();
}

}
}



function surveillance_camera
{
while(1)
{

if (cam_counter == 1) // this would be your first camera
{
camera.visible = off; // hide the default "camera"
surv_camera.x = -1173.52; // X Wert aus Wed übertragen
surv_camera.y = -925.883; // y Wert aus Wed übertragen
surv_camera.z = -231.134; // z Wert aus Wed übertragen
surv_camera.pan = 90; // Pan-Winkel aus wed übertragen
surv_camera.tilt = 0; // tilt-Winkel aus Wed übertragen
surv_camera.roll = 0; // roll-Winkel aus Wed übertragen
surv_camera.visible = on; // and make it visible
cam1_pan.visible = on; // Panel der Kamera

}
if (cam_counter == 2) // this would be your second camera
{
surv_camera.visible = off; // alte wiew aus
surv_camera.x = 2854.030;
surv_camera.y = -505.735;
surv_camera.z = -445.891;
surv_camera.pan = 180;
surv_camera.tilt = 0;
surv_camera.roll = 360;
surv_camera.visible = on; // neue an
cam1_pan.visible = on; // Panel der Kamera
}
else
{
if (cam_counter == 0) // kamerasicht deaktivieren
{
surv_camera.visible = off;
camera.visible = on;
cam1_pan.visible = off;
cam2_pan.visible = off;

}
}
wait(1);
}
}



By. White_Wolf

Deutsch:

@tompo

Ich habe deine Codevorschläge mal getestet. Aber leider wecheslt es mit diesen Code nur zur ersten Kamera und nicht zur zweiten und auch nicht mehr zurück zum Spieler. So dass ich den Code nochmals geändert habe. Leider geht er jetzt gar nicht mehr. Warum nicht? (Den code mit indicator == _HANDLE habe ich aus eine Lampen Scribt mit dem Man Lampen mit hilfe min Lichtschaltern aus und an manchen kann und da geht es) Warum geht dasselbe nicht bei den Kameras?

Tschau
White_Wolf

P.S. Sorry for my bad englich


A8 Com Version 8.40 Win 7 64 Bit
Re: surveillance_camera_code problem (AUM 10) [Re: White_Wolf] #133317
06/25/07 10:41
06/25/07 10:41
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
Did nobody know a solution of my problem?

By
White_Wolf

Deutsch

Weiß den keiner eine Lösung für mein Problem?


A8 Com Version 8.40 Win 7 64 Bit

Moderated by  George 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1