Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,388 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
error 1513 script error on startup #363584
03/13/11 15:03
03/13/11 15:03
Joined: Jan 2011
Posts: 65
R
reknak Offline OP
Junior Member
reknak  Offline OP
Junior Member
R

Joined: Jan 2011
Posts: 65
Hi guys,

I get this error: 'error 1513 script error' when I run my script. Before I got the error, I stored the health of the player in my script in a global variable
Code:
var healthplayer

, now I want to store the health of the player in skill4 HEALTH
Code:
#define HEALTH    skill4

, so I changed all 'healthplayer' (like in a panel which shows the players health or e.g. in hit events) into 'player.skill4' (without the quotes ofcourse) and now I get the above mentioned script error. I have the
Code:
player = my;

located in the action of the player ent.

Does anyone know what is wrong? Thanks for taking the time!

Here are some relevant pieces of my script:

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlView.c>


#define STATE     skill1
#define ANIMATION skill2
#define CREATOR   skill3
#define HEALTH    skill4
#define DAMAGE    skill5

///////////////////////////////
....

PANEL* first_pan =
{
	pos_x = 1077;
	pos_y = 949;
	layer = 1;
	bmap = healthbarframe_bmp;
	flags = OVERLAY | SHOW;
}

PANEL* second_pan =
{
    window (1080, 949, 65, 25, "healthbar.bmp", player.skill4, 0);
    flags = SHOW;
}

PANEL* third_pan =
{
	digits (1100, 930, 3, "Arial#15b", 0.667, player.skill4); 
	flags = SHOW | OUTLINE;
}
....

///////////////////////////// Gravity /////////////////

function handle_gravity()
{
	result = c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_PASSABLE|IGNORE_MODELS|USE_BOX);
	if (key_ctrl)
	{
	if(result > 6)
	{
		if (result > 400) 
		{
		player.skill4 -= result/80; //ignore this lame fall damage code :P
		if (player.skill4 <= 0) 
		{
	     	my.ANIMATION = 0;
			my.STATE = 4; // 4 = dead		  	
		}
		}
		absdist.z -= 1.5 * time_step;
	}
	else
	{
	if (result <= 4)
	{
		if (absdist.z < 1) absdist.z += 1 * time_step;	
	}
	else
	{		
		absdist.z = 0;
	}
	}
	}
	
	
	else
	{
	if(result > 12)
	{
		if (result > 400) 
		{
		player.skill4 -= result/80; //ignore this lame fall damage code :P
		if (player.skill4 <= 0) 
		{
	     	my.ANIMATION = 0;
			my.STATE = 4; // 4 = dead		  	
		}
		}
		absdist.z -= 2 * time_step;
	}
	else
	{
	if (result <= 10)
	{
		if (absdist.z < 1) absdist.z += 1 * time_step;		
	}
	else
	{		
		absdist.z = 0;
	}
	}
	}
}

....

function main()
{
....		
	while (1)
	{
		....
		if (player.skill4 > 0) {camera.pan -= mouse_force.x * (8 * time_step);}	
		}
		if (player.skill4 > 0)
		{
		camera.tilt += mouse_force.y * (8 * time_step);	
		camera.tilt = clamp(camera.tilt,-50,50);	
			
			....						   			
    		if (mana < 150 + (energy * 15))
				mana += 0.07 + (energy * 0.01);
			if (player.skill4 < 150 + (vitality * 15))
				player.skill4 += 0.03 + (vitality * 0.01);	
					if (mana > 150 + (energy * 15))
						mana -= 0.05;
					if (player.skill4 > 150 + (vitality * 15))
						player.skill4 -= 0.05;
		}				
		wait (1);
	}
}

....

// hit event
function wizard_hit()
{
if (my.STATE != 4)
{		
	player.skill4 -= you.DAMAGE;
	if (player.skill4 <= 0) 
		{
	     	my.ANIMATION = 0;
			my.STATE = 4; // 4 = dead		  	
		}
}		
}

....


action wizard_walk()
{ 
	player = my;
	camera_follow(me);
	camera.genius = my;
	camera.arc = 80;

....



Re: error 1513 script error on startup [Re: reknak] #363585
03/13/11 15:13
03/13/11 15:13
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
When your game starts the player pointer is not valid and hence accessing player.skill4 will give you the crash. Change your panels to work with global variables instead.


Always learn from history, to be sure you make the same mistakes again...
Re: error 1513 script error on startup [Re: Uhrwerk] #363803
03/14/11 19:12
03/14/11 19:12
Joined: Jan 2011
Posts: 65
R
reknak Offline OP
Junior Member
reknak  Offline OP
Junior Member
R

Joined: Jan 2011
Posts: 65
Ok, thanks for the help.


Gamestudio download | 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