Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
? about enable_touch #175450
12/31/07 00:14
12/31/07 00:14
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline OP
Member
raiden  Offline OP
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
I found this a little puzzling, possibly someone can tell me why it does not work.

Code:


function touch_event()
{
if(event_type == event_touch)
{
if(mouse_right)
{
breakpoint;
}
}
}
action test_touch
{
my.enable_touch = on;
my.event = touch_event;
}



I do not understand why the breakpoint does not trip when I touch the entity, and right click the mouse at the same time, but it doesn't.

I assumed events were checked every frame, but I could be wrong.

Thanks for any help.

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Re: ? about enable_touch [Re: raiden] #175451
12/31/07 01:44
12/31/07 01:44
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Events are NOT triggered every frame. Try hold rightclick and move over the entity . There are many ways to reach what you want, for example:

if (event_type == event_touch) {
while (!mouse_right) {wait(1);} //wait until the rightmouse is pressed
breakpoint;
}

This code is not well thought. It works, but there are downsides. It just depends how, what and when you need it.

Last edited by Joozey; 12/31/07 01:47.
Re: ? about enable_touch [Re: Joozey] #175452
12/31/07 13:52
12/31/07 13:52
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
didnt test it but you cold do it like this

Code:

action test_touch
{
while(my!=null)
{
if(my.skill5 ==1)
{
breakpoint;
my.skill5 =0;
}
wait(1);
}
}

function mouskill()
{
while(1)
{
if(mouse_right == 1)
{
if(mouse_ent)
{
you.skill5 = 1;
}
}
wait(1);
}
}

function main
{
//lvl_load and mouse settings
mousekill();
}




"empty"
Re: ? about enable_touch [Re: flits] #175453
12/31/07 15:17
12/31/07 15:17
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline OP
Member
raiden  Offline OP
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
Thank you both for the replies and suggestions. I understand now that events are different than loops, being that they are only triggered when the event has happenned and not every frame.

Makes even more sense when I put a "beep;" instruction in the event touch check, and I hear it only trigger once per each time I move the mouse over the entity.

I'll use a skill to set if the entity has been touch, and moniter that skilll in a loop to do further instructions.

Thanks again for helping me clarify this.

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Re: ? about enable_touch [Re: raiden] #175454
01/02/08 12:23
01/02/08 12:23
Joined: Oct 2002
Posts: 4,753
Munich, Bavaria, South of Germ...
TripleX Offline
Expert
TripleX  Offline
Expert

Joined: Oct 2002
Posts: 4,753
Munich, Bavaria, South of Germ...
btw: There is also an event: EVENT_RELEASE you could use for your instruction..

if(event_type == EVENT_TOUCH)
{
my.mouse_over = 1;
}
if(event_type == EVENT_RELEASE)
{
my.mouse_over = 0;
}

//....
while(1)
{
if(my.mouse_over == 1 && mouse_right) { .. }
wait(1);
}


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