Gamestudio Links
Zorro Links
Newest Posts
zorro with ccxt?
by opm. 03/03/26 03:17
ZorroGPT
by TipmyPip. 03/02/26 18:13
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 5,263 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem mit Button #391254
01/09/12 18:13
01/09/12 18:13
Joined: May 2008
Posts: 113
Italien, Südtirol, Naturns
P
Patrick92 Offline OP
Member
Patrick92  Offline OP
Member
P

Joined: May 2008
Posts: 113
Italien, Südtirol, Naturns
Hallo ich hab ein Problem ich glaube aber es müsste gehen aber es geht nicht kann mir bitte jemand helfen

ich möchte in der Function folgendes machen:
Code:
function slot1tog1()
{
	
	if(slot1 > 0 && obj_mouse == 0)
	{
		obj_mouse = slot1;
		slot1 = 0;
	}
	if(slot1 == 0)
	{
		slot1 = obj_mouse;
		obj_mouse = 0;
	}
	if(slot1 > 0 && obj_mouse > 0)
	{
		obj_mouse_sav = slot1;
		slot1 = obj_mouse;
		obj_mouse = obj_mouse_sav;
	}
}



aber es macht nur das was in der ersten if steht und wenn die erste nicht Wahr ist dann passiert garnichts.

und wenn ichs so mach:
Code:
function slot1tog1()
{
	
	if(slot1 > 0 && obj_mouse == 0)
	{
		obj_mouse = slot1;
		slot1 = 0;
	}
}
function slot1tog2()
{
	if(slot1 == 0)
	{
		slot1 = obj_mouse;
		obj_mouse = 0;
	}
}
function slot1tog3()
{
	if(slot1 > 0 && obj_mouse > 0)
	{
		obj_mouse_sav = slot1;
		slot1 = obj_mouse;
		obj_mouse = obj_mouse_sav;
	}
}

PANEL* BOTTOM_SLOT1_on =
{
	pos_x = 550; pos_y = 200;
	button(0,0,SLOT_OVER,SLOT_ON,SLOT_OVER,slot1tog1,slotname_re,slot1name);
	flags =  SHOW;
	layer = 2;
}

PANEL* BOTTOM_SLOT1_off =
{
	pos_x = 550; pos_y = 200;
	button(0,0,SLOT_OVER,SLOT_ON,SLOT_OVER,slot1tog2,slotname_re,slot1name);
	flags =  SHOW;
	layer = 2;
}

PANEL* BOTTOM_SLOT1_obj_m =
{
	pos_x = 550; pos_y = 200;
	button(0,0,SLOT_OVER,SLOT_ON,SLOT_OVER,slot1tog3,slotname_re,slot1name);
	flags =  SHOW;
	layer = 2;
}



dann funktioniert es.

was könnte das problem sein?

danke im voraus

MfG

Patrick

Re: Problem mit Button [Re: Patrick92] #391625
01/14/12 13:07
01/14/12 13:07
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Hmm...

Die variable slot1 wird in der ersten if-Anweisung auf 0 gesetzt.
dannach wird if(slot1 == 0)... ausgeführt
Das macht in meinen Augen nicht viel sinn.

Es wäre hilfreich, wenn du sagen könntest, was der Code machen soll.


POTATO-MAN saves the day! - Random
Re: Problem mit Button [Re: Kartoffel] #391850
01/16/12 16:28
01/16/12 16:28
Joined: May 2008
Posts: 113
Italien, Südtirol, Naturns
P
Patrick92 Offline OP
Member
Patrick92  Offline OP
Member
P

Joined: May 2008
Posts: 113
Italien, Südtirol, Naturns
habs schon gelöst hier ist der fertige

das ist für ein inventar die function für die Buttons

Code:
function slot_var_update(var SLOTNUM)
{	
	
	if(obj_mouse > 0 && slot[SLOTNUM] == 0)
	{
		slot[SLOTNUM] = obj_mouse;
		obj_mouse = 0;
		
	}
	else if(obj_mouse == 0 && slot[SLOTNUM] == 0)
	{
		slot[SLOTNUM] = 0;
		obj_mouse = 0;
		
	}
	else if(obj_mouse == 0 && slot[SLOTNUM] > 0)
	{
		obj_mouse = slot[SLOTNUM];
		slot[SLOTNUM] = 0;
		
	}
	else if(obj_mouse > 0 && slot[SLOTNUM] > 0)
	{
		obj_mouse_sav = slot[SLOTNUM];
		slot[SLOTNUM] = obj_mouse;
		obj_mouse = obj_mouse_sav;
		obj_mouse_sav = 0;
		
	}
	
}






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