Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 666 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
reset function #423589
06/01/13 14:46
06/01/13 14:46
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
How could I make this function reset. So the picture get's
placed at it's original start point ?

Code:
PANEL* looptxt_pan =

{

	bmap = "nextstage.tga";
	pos_x = 1054;
	pos_y = 350;
	layer = 50;	
}
function looptxt()
{

	wait(3);
	set(looptxt_pan,SHOW | OVERLAY);
	while(1)
	{
		looptxt_pan->pos_x = cycle(looptxt_pan->pos_x -30 * time_step,-bmap_width(looptxt_pan->bmap),screen_size.x);
		wait(1);
	}
}



It works for now but i need to be able to reset this complete
function so it can be used all over when needed.


Thx for your time laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: reset function [Re: Realspawn] #423590
06/01/13 15:19
06/01/13 15:19
Joined: May 2013
Posts: 23
Somewhere
W
Wiseguy Offline
Newbie
Wiseguy  Offline
Newbie
W

Joined: May 2013
Posts: 23
Somewhere
Not to sound rude, but you've got to be kidding, right? I mean, you've over 4k posts and are apparently a long time user and even a moderator.


His words are wise, his face is beard.
Re: reset function [Re: Realspawn] #423594
06/01/13 16:03
06/01/13 16:03
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline
Member
krial057  Offline
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
Just set the position to the original position at the start of the function. You could use defines to make the code easier to customize:
Code:
#define LOOPTXT_PAN_ORIGINAL_X 1054
#define LOOPTXT_PAN_ORIGINAL_Y 350
PANEL* looptxt_pan =

{

	bmap = "nextstage.tga";
	pos_x = LOOPTXT_PAN_ORIGINAL_X ;
	pos_y = LOOPTXT_PAN_ORIGINAL_Y ;
	layer = 50;	
}
function looptxt()
{
	wait(3);
	looptxt_pan->pos_x = LOOPTXT_PAN_ORIGINAL_X ;
	looptxt_pan->pos_y = LOOPTXT_PAN_ORIGINAL_Y ;
	set(looptxt_pan,SHOW | OVERLAY);
	while(1)
	{
		looptxt_pan->pos_x = cycle(looptxt_pan->pos_x -30 * time_step,-bmap_width(looptxt_pan->bmap),screen_size.x);
		wait(1);
	}
}


Re: reset function [Re: krial057] #423595
06/01/13 16:12
06/01/13 16:12
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
thank you laugh

As i always mention i am a non coder laugh have a fulltime job
and do this in my free time for fun laugh so nope i am not kidding laugh
the number of posts and the fact that i moderate has nothing to do with me not beeing a coder laugh Although i understand why people think that.

I like to toy with 3DGS and enjoy seeing enough people out here still willing
to help out. All i do know and learn is on my noob site laugh so people like me
can still try to create fun things laugh

I will always envy those fast coders wink






Last edited by Realspawn; 06/01/13 16:13.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: reset function [Re: Realspawn] #423596
06/01/13 16:19
06/01/13 16:19
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
You could do it in another way aswell..
(dont be so modest , everyone can code and everyone who can code needs help one time or another)

If you used a variable of integer instead of
while(1) like while(not_reached_border)
then when your x position reaches your req x position set not_reached_border to 1..

This will help to exit the while loop if you dont want it to loop all the time..

Last edited by Wjbender; 06/01/13 16:20.

Compulsive compiler
Re: reset function [Re: Wjbender] #423615
06/02/13 00:55
06/02/13 00:55

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
If you used a variable of integer instead of
while(1) like while(not_reached_border)
then when your x position reaches your req x position set not_reached_border to 1..


Why would you do this? 'while' is a comparison.
Code:
while(pan->pos_x < screen_size.x- bmap_width(pan->bmap)){ ...code...  
wait(1);}
.. then restore pan->pos_x to your save starting points...



Why create variable?

Last edited by Malice; 06/02/13 00:59.
Re: reset function [Re: ] #423618
06/02/13 08:53
06/02/13 08:53
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Because you could globaly reset that variable and your code comes dow. To the same thing an evaluation ..(malis)

By the way if your going to respond to someone asking help be fucking friendly not a dickhead(wiseguy)

Last edited by Wjbender; 06/02/13 08:55.

Compulsive compiler
Re: reset function [Re: Wjbender] #423623
06/02/13 10:27
06/02/13 10:27
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
@ krial

I tried your code but the i get number syntax errors ?
pos_x = LOOPTXT_PAN_ORIGINAL_X ;
pos_y = LOOPTXT_PAN_ORIGINAL_Y ;

perhaps i need to do something extra that I simply don't see


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: reset function [Re: krial057] #423627
06/02/13 12:40
06/02/13 12:40
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline
Member
krial057  Offline
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
Oh, my bad. Didn't know about this:

Quote:
Within the struct initialization, any numbers, variables, character strings, or pointers to other structs can be used, but internal engine variables (such as "camera"), and #defines (such as a previously defined "NUMBER_OF_ARRAY_ELEMENTS") can not be used.


I tried using variables instead of defines, but that doesn't work either frown (However, as I understand the manual, it should... I tested using variables in custem defined structs and there it works...)

If you are only using looptxt to show the panel, you could emit the position initialisation in the panel definition:

Code:
#define LOOPTXT_PAN_ORIGINAL_X 1054
#define LOOPTXT_PAN_ORIGINAL_Y 350
PANEL* looptxt_pan =

{

	bmap = "nextstage.tga";
	layer = 50;	
}
function looptxt()
{
	wait(3);
	looptxt_pan->pos_x = LOOPTXT_PAN_ORIGINAL_X ;
	looptxt_pan->pos_y = LOOPTXT_PAN_ORIGINAL_Y ;
	set(looptxt_pan,SHOW | OVERLAY);
	while(1)
	{
		looptxt_pan->pos_x = cycle(looptxt_pan->pos_x -30 * time_step,-bmap_width(looptxt_pan->bmap),screen_size.x);
		wait(1);
	}
}



Ohterwise, you have to put the numbers manually in the struct as you did at the start.

Re: reset function [Re: krial057] #423646
06/02/13 16:31
06/02/13 16:31
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
Since i am no coder i want to ask (have to ask)
to learn from it.

My original code works. But is there no easy way to reset/kill
a function so it can be recalled ?

i looked into proc_kill2 that works but does not reset the pictures position:) It should be possible that this function
plays once every time it is called ?

Am i thinking to simple laugh



Last edited by Realspawn; 06/02/13 17:01.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Page 1 of 2 1 2

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