Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, bigsmack), 1,581 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Still having problems with this... #134663
06/08/07 04:35
06/08/07 04:35
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
I've been stuck on this problem for weeks now. I'm trying to find a way for the mouse cursor to touch something in 3D space which causes text to pop up to let the user know that the mouse is touching an object. I am still having problems trying to get it work. This is what I have done:

Code:
	string str1 = "The mouse is touching the tree. \n Testing the text now. \n testing the line breaks also! loading.....";


mouse_test();
mouse_event();

function mouse_event()
{

if(event_type == event_touch)
{
my.transparent = on;
my.alpha = 50;
contact_text.string = str1;
}
if(event_type == event_release)
{
my.transparent = off;
}


}


function mouse_test()
{

while(1)
{

temp.x = MOUSE_POS.x;
temp.y = MOUSE_POS.y;
temp.z = 9999.99;
vec_for_screen(temp, camera);
wait(1);
}
}




thanks in advance...

Last edited by Knuckles; 06/08/07 04:36.
Re: Still having problems with this... [Re: Knuckles] #134664
06/08/07 06:23
06/08/07 06:23
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
You need to enable mouse engine pointer "mouse_mode = 1",
then sync the mouse_pos with mouse_cursor :

Code:

function mouse_test()
{
mouse_mode = 1;
mouse_range = 2000; // if necessary
while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;

temp.x = MOUSE_POS.x;
temp.y = MOUSE_POS.y;
temp.z = 9999.99;
vec_for_screen(temp, camera);
wait(1);
}
}

Re: Still having problems with this... [Re: vlau] #134665
06/11/07 23:29
06/11/07 23:29
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
It's still not working when I hover the mouse over the tree.

Re: Still having problems with this... [Re: Knuckles] #134666
06/12/07 00:53
06/12/07 00:53
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
You've forgotten add to entity's action:

my.enable_mouse = on;
my.ENABLE_touch = ON;
my.enable_realase = on;


Never say never.
Re: Still having problems with this... [Re: tompo] #134667
06/14/07 18:35
06/14/07 18:35
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
still not working...

Here's the breakdown:

Func.wdl
--------
Code:
font standard_font = "Arial",3,18;

text contact_text
{
font = standard_font;
layer = 10;
pos_x = 350;
pos_y = 100;
size_y = 70;
offset_y = 0;
flags = center_x, narrow, visible;
}


string str1 = "The mouse is touching the tree. \n Testing the text now. \n testing the line breaks also! loading.....";


function mouse_event()
{

if(event_type == event_touch)
{
my.transparent = on;
my.alpha = 50;
contact_text.string = str1;
}
if(event_type == event_release)
{
my.transparent = off;
}


}


function mouse_test()
{
mouse_mode = 1;
mouse_range = 2000;
while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
temp.x = MOUSE_POS.x;
temp.y = MOUSE_POS.y;
temp.z = 9999.99;
vec_for_screen(temp.z, camera);

if(event_type == event_touch)
{
contact_text.string = str1;
}

wait(1);
}
}




Var.wdl
-------
Code:
entity* tree;


action npc1_act
{
tree = me;
tree = my;
enable_mouse = on;
my.enable_click = on;
my.enable_touch = ON;
my.enable_release = on;

my.event = mouse_event();
mouse_range = 20;
mouse_mode = 1;
}


view camera
{
layer = 0;
arc = 60;
aspect = 1;
ambient = 80;
flags = visible;
}




Main.wdl
--------
Code:
include <var.wdl>;
include <int.wdl>;
include <func.wdl>;


//Startup()
starter start_up()
{
level_load(field_level);

while(tree == null)
{
wait(1);
}


bg_color.red = 0;
bg_color.green = 3;
bg_color.blue = 30;


wait(10);

mouse_test();
mouse_event();

}



Last edited by Knuckles; 06/14/07 18:36.
Re: Still having problems with this... [Re: Knuckles] #134668
06/14/07 19:04
06/14/07 19:04
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
couple of mistakes

mouse_range = 20; // increase this value !! to f.e. 9999

MOUSE_POS.X = POINTER.X; MOUSE_POS.Y = POINTER.Y;
temp.x = MOUSE_POS.x;
temp.y = MOUSE_POS.y;
temp.z = 1000;
vec_for_screen(temp,CAMERA); //not temp.z


in function mouse_test()
if(event_type == event_touch)
{
contact_text.string = str1;
} - this is useless ;P this should be set in some entity's action not in stand-alone function

I think that all you need is:
1.
- in main function
mouse_mode = 1;
mouse_range = 9999;
- in main's function loop
MOUSE_POS.X = POINTER.X; MOUSE_POS.Y = POINTER.Y;

2. in entity's action
my.enable_mouse = on; my.enable_touch = on; my.enable_realase = on;
my.event = my_event;

3. function my_event
{
if(event_type == event_touch){my.transparent = on; my.alpha = 50;}
if(event_type == event_realase){my.transparent = off; my.alpha = 100;}
}


Last edited by tompo; 06/14/07 19:16.

Never say never.
Re: Still having problems with this... [Re: Knuckles] #134669
06/15/07 08:19
06/15/07 08:19
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
OK... this is working for sure, I've checked this. YouTube
Just copy this code, that's all YOu need:

Code:
 
entity* player;
bmap arrow ="arrow_blue.pcx";

function my_event
{
if(event_type == event_touch)
{
my.transparent = on;
}
if(event_type == event_release)
{
my.transparent = off;
}
}

action my_player
{
player = me;
mouse_mode = 1;//make cursor visible and moving
mouse_map = arrow;//mouse bmap
mouse_range = 10000;//mouse range from camera
my.enable_touch = on;
my.enable_release = on;
my.event = my_event;
while(me)
{
MOUSE_POS.X = POINTER.X; MOUSE_POS.Y = POINTER.Y;
wait(1);
}
}




Last edited by tompo; 06/15/07 09:13.

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