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
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 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
Once Again a Script Crash #412070
11/22/12 13:37
11/22/12 13:37
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Code:
int InitilizeApplet(Applet * applet)
{
	if(applet->init) { return error("InitilizeApplet:Applet already initilized."); }
	void func();
	func = applet->Initilize;
	func();
	return 0;
}



It's understood by the title!Something is causing a Script Crash in this function.


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Once Again a Script Crash [Re: Yashas] #412080
11/22/12 14:29
11/22/12 14:29
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
applet->Initilize is not a valid function pointer (or applet points to garbage).
I really don't want to offend you, but looking at your thread history I would highly suggest you to learn a bit about pointers as it appears like you are doing the same basic errors over and over again.

Last edited by JustSid; 11/22/12 14:33. Reason: Clarified that applet shouldn't be a function pointer

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Once Again a Script Crash [Re: WretchedSid] #412096
11/22/12 16:35
11/22/12 16:35
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Mastering Pointers.......(Learning) laugh

I did not understand what you meant by applet->initilize is not a valid function.

Here is a more clear explanation:
Everything starts here in my configuration file
Code:
void InitApplets ()
{
	Applet * Calender;
	Calender = CreateApplet("Calender","Tex","1.0","Displays Day,Month,Year",AppletCalenderPanel,AppletCalender_Drag,AppletCalenderInit,AppletCalenderDeInit);
	RegisterApplet(Calender);
	
	
}


I give AppletCalenderInit function as function parameter.

And that parameter is processed here:
Code:
Applet * CreateApplet(STRING * Name,STRING * Author,STRING * Version,STRING * Description,PANEL * Container,BMAP * Drag,int * Initilizer,int * Deinitlizer)
{
	if(!Container) { return error("CreateApplet:Invalid Container."); }
	if(!Initilizer) { return error("CreateApplet:Invalid Initilizer."); }
	if(!Deinitlizer) { return error("CreateApplet:Invalid Deinitilizer."); }
	if(!Name) { return error("CreateApplet:Invalid Name."); }
	
	Applet * Temp = sys_malloc(sizeof(Applet));
	
        .....SOME STATEMENTS ARE HERE WHICH ARE NOT RELATED TO THIS       
        TOPIC:REMOVED         

	Temp->Initilize	= Initilizer;
	Temp->Deinitlize = Deinitlizer;
	return Temp;
}



The structure stores the functions as:
Code:
typedef struct Applet 
{
        ........

	void *Initilize;
	void *Deinitlize;

        ........
} Applet;



Now it must be very clear laugh


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Once Again a Script Crash [Re: Yashas] #412099
11/22/12 16:47
11/22/12 16:47
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Didnt look it all over but i saw this
applet *temp=malloc(sizeof(applet))
Try
applet *temp=(applet*)malloc(sizeof(applet))
i might be wrong with it as i just stared at that part and nothing else


Compulsive compiler

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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