Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
while function doesnt run (german and english) #177303
01/10/08 16:44
01/10/08 16:44
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
Code:

include <options.txt>;
bmap des_1 = <des_1.bmp>;
var schalter1_vis_des1 = 1;
panel design1
{
bmap = des_1;
flags = transparent,visible;
}
function whiler1()
{
if(schalter1_vis_des1 == 1)
{
design1.alpha = 100;
}
else
{
design1.alpha = 0;
}
}
function main()
{
design1.alpha = 100;
while(1)
{
whiler1();
wait(1);
}
}
function aa()
{
schalter1_vis_des1 = 0;
}
on_anykey = aa();



Durch diesen Script soll ein Panel erscheinen und beim Druck irgendeinen Knopfes unsichtbar werden. Allerdings tut sich nichts. Ich habe den Verdacht, dass "function whiler1()" nicht wiederholt wird, trotz while.
Was ist an dem Script fehlerhaft?
options.txt beinhaltet nur: var video_mode = 7;

This script must do a panel visible and if I press anykey than the panel must be invisible. But not happens if I press anykey. I think, function whiler1() wasn't while, but it should while.
Where is the error?
options.txt includes only: var video_mode = 7;

Re: while function doesnt run (german and english) [Re: JokeSpeaker] #177304
01/10/08 17:55
01/10/08 17:55
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
Code:


bmap des_1 = <des_1.bmp>;
var schalter1_vis_des1 = 1;

panel design1
{
button = 0,0,des_1,des_1,des_1,des1_func,null,null;
flags = visible;
}

function des1_func()
{
if(schalter1_vis_des1 == 1)
{
design1.visible = off;
}
else
{
design1.visible = on;
}
schalter1_vis_des1 += 1;
schalter1_vis_des1 %= 1;
}

function aa()
{
schalter1_vis_des1 = 0;
}

on_anykey = aa();




i never tryed white .txt file

Last edited by flits; 01/10/08 18:43.

"empty"
Re: while function doesnt run (german and english) [Re: flits] #177305
01/10/08 18:14
01/10/08 18:14
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
Oo your script didn't that what it must, too. ><
Is my 3DGS damaged? I have A7 Extra

Quote:

i never tryed white .txt file



Quote:

options.txt includes only: var video_mode = 7;




Re: while function doesnt run (german and english) [Re: JokeSpeaker] #177306
01/10/08 18:29
01/10/08 18:29
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Code:

function main() {
while (1) {
if (key_a) {design1.visible = on;}
else {design1.visible = off;}
wait(1);
}
}




Click and join the 3dgs irc community!
Room: #3dgs
Re: while function doesnt run (german and english) [Re: JokeSpeaker] #177307
01/10/08 18:42
01/10/08 18:42
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
realy srry didnt read it good


Code:

bmap des_1 = <des_1.bmp>;
var schalter1_vis_des1 = 0;

panel design1
{
bmap = des_1;
flags = visible;
}

function des1_func()//solution2
{
while(1)
{
if(schalter1_vis_des1 == 1)
{
design1.visible = off;
schalter1_vis_des1 = 0;
}
if(schalter1_vis_des1 == 2)
{
design1.visible = on;
schalter1_vis_des1 = 0;
}
wait(1);
}
}

function aa()
{
design1.visible = off;//solution 1
schalter1_vis_des1 = 1;//solution2
}

on_anykey = aa();




"empty"
Re: while function doesnt run (german and english) [Re: flits] #177308
01/10/08 19:22
01/10/08 19:22
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
@Joozey thx, but I want a script, who make the panel invisible when the variable is 0 and when the variable is 1, the panel should be visible.

I want to programming a program, in that the panel will be invisible, when a function has made the var 0 and when it is 1 than visible. But I have the feeling than the while function want not while everytime.

Re: while function doesnt run (german and english) [Re: JokeSpeaker] #177309
01/10/08 21:33
01/10/08 21:33
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hello,

you should change
on_anykey = aa();
to
on_anykey = aa;

aa() would pass the functions return value to on_anykey (in this case 0, as aa doesnt return anything).
To assign the function to on_anykey you just have to leave the brackets out.

Re: while function doesnt run (german and english) [Re: Fenriswolf] #177310
01/11/08 12:37
01/11/08 12:37
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
Code:
bmap des_1 = <des_1.bmp>;
panel design1
{
pos_x = 0;
pos_y = 0;
bmap = des_1;
}
function main()
{
design1.visible = on;
}



This script didn't run too... -.-
Can someone find an error in this script?

Re: while function doesnt run (german and english) [Re: JokeSpeaker] #177311
01/13/08 20:19
01/13/08 20:19
Joined: Sep 2007
Posts: 67
Seevetal, Germany
Rasterbar Offline
Junior Member
Rasterbar  Offline
Junior Member

Joined: Sep 2007
Posts: 67
Seevetal, Germany
Hi,
hier währe mein vorschlag:
Code:

bmap des_1 = <vehdlg1.pcx>;

var schalter1_vis_des1 = 0;

panel design1
{
bmap = des_1;
}
function des1_func()//solution2
{
while(1)
{
if(schalter1_vis_des1 == 0)
{
design1.visible = off;
}
if(schalter1_vis_des1 == 1)
{
design1.visible = on;
}

wait(1);
}
}

function main
{
vec_set(screen_color,vector(255,0,0)); // blau
/*
level_load("dummy.wmb");
wait(1);
*/
des1_func();
}

function aa()
{
// design1.visible = (design1.visible == off);

if (schalter1_vis_des1 == 1)
{
schalter1_vis_des1 = 0;
}
else
{
schalter1_vis_des1 = 1;
}
}
on_anykey = aa;



mfg

Re: while function doesnt run (german and english) [Re: Rasterbar] #177312
01/18/08 18:55
01/18/08 18:55
Joined: Mar 2007
Posts: 151
JokeSpeaker Offline OP
Member
JokeSpeaker  Offline OP
Member

Joined: Mar 2007
Posts: 151
thx aber ich habe das noch nicht getestet, weil ich jetzt mein Game ohne panels progge.


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

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