Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (monarch), 1,259 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
my gun scope script #276417
07/04/09 23:29
07/04/09 23:29
Joined: Jun 2009
Posts: 38
H
hungryhobo Offline OP
Newbie
hungryhobo  Offline OP
Newbie
H

Joined: Jun 2009
Posts: 38
Hello, I am trying to make a simple script to let the character look through his gun scope and have it zoom in a certain distance.

I tried to make it by editing my panel to display the main panel when not zoomed in and the other while zooming, but i could not use a conditional to distinguish in the panel function. it returned an error. also, the camera would not zoom in when prompted.

if anyone could offer some advise, resources, or point me in the right direction, it owuld be greatly appreciated.

here is some of my code.
Code:
//zoom in function
function zoom_scope()
{
	scope_on = (scope_on == off);
	var temp_cam;
	temp_cam.x = camera.x;
	temp_cam.y = camera.y;
	temp_cam.z = camera.z;
	while(scope_on == 1)
	{
		camera.x = temp_cam.x + 50;
		
	}
	camera.x = temp_cam.x;
}

//PANEL SCRIPT

var x = 4;
bmap scope <"scope.bmp">;
bmap the_panel <"panel.bmp">;
font font1 = "font1_blue.pcx",12,16;  // named the font digi_font
panel game_panel
{
		//tried to do condition but did not compile
		if(scope_on == on)
		{
			bmap = scope;
			
		}
		else
		{
		
		bmap = the_panel;
		flags = visible, overlay;
		//player.ammo = clip_ammo[current_weapon];
		digits = 470,579,3,font1,1,player.health;
		digits = 15,579,3,font1,1,player.battery;
		digits = 730,579,3,font1,1, player.ammo;
		digits = 246,579,3,font1,1,player.armor;
		}
}





Last edited by rvL_eXile; 07/05/09 01:02.
Re: my gun scope script [Re: hungryhobo] #276421
07/04/09 23:43
07/04/09 23:43
Joined: Dec 2008
Posts: 528
Wagga, Australia
the_mehmaster Offline
User
the_mehmaster  Offline
User

Joined: Dec 2008
Posts: 528
Wagga, Australia
i'll make it easier for others to read:
(use [ code ] and [ /code ])
Code:
//zoom in function
function zoom_scope()
{
	scope_on = (scope_on == off);
	var temp_cam;
	temp_cam.x = camera.x;
	temp_cam.y = camera.y;
	temp_cam.z = camera.z;
	while(scope_on == 1)
	{
		camera.x = temp_cam.x + 50;

	}
	camera.x = temp_cam.x;
}

//PANEL SCRIPT

var x = 4;
bmap scope <"scope.bmp">;
bmap the_panel <"panel.bmp">;
font font1 = "font1_blue.pcx",12,16; // named the font digi_font
panel game_panel
{
	//tried to do condition but did not compile
	if(scope_on == on)
	{
		bmap = scope;

	}
	else
	{

		bmap = the_panel;
		flags = visible, overlay;
		//player.ammo = clip_ammo[current_weapon];
		digits = 470,579,3,font1,1,player.health;
		digits = 15,579,3,font1,1,player.battery;
		digits = 730,579,3,font1,1, player.ammo;
		digits = 246,579,3,font1,1,player.armor;
	}
}


I also recommend that this be moved to the c-script(at least i think it's c-script..) thread. Doesn't have much to do with the editors!smile

Re: my gun scope script [Re: the_mehmaster] #276436
07/05/09 01:12
07/05/09 01:12
Joined: Apr 2005
Posts: 3,076
Germany, NRW
rvL_eXile Offline

3D Artist
rvL_eXile  Offline

3D Artist

Joined: Apr 2005
Posts: 3,076
Germany, NRW
Hi,

i think you have to read some Tutorials or the Manual...
There some big mistakes in your Script...

First:
scope_on = (scope_on == off);

is Scope_on a Var? why do you write (scope_on==off)
You could write scope_on=0;

Second:

if(scope_on == on)
{
bmap = scope;

}

Here you have to wirte if(scope_on==1) /1=on / 0=off

bmap=scope.....
Write Scope.visible=on;


Third:

If / Else in a Panel Definition? This must be declared in a Function...


You have to Learn much, so read Tutorials and the Manual !

cYa Sebastian


Tutorials:
[Blender]Terrain creation ENG/GER
[Blender]Low Poly Tree Modeling
[GIMP]Create a Texture for Terrains
CLICK HERE



Moderated by  HeelX, rvL_eXile 

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