Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Clickable Buttons With DrawText
Topic Started: Oct 30 2010, 02:46 PM (252 Views)
alexw
Member Avatar
Advanced Member
[ *  *  * ]
Hi,

I have the follow text based on some information i figured out how to make the best script for buttons:
MakeClickableButton:
Code:
 

DrawText(argument0,argument1,argument2,argument3);

StrLength = string_length(argument3);

if(IfMousePos2(argument0,argument1,argument1+(StrLength*6.5),argument1)){
return true;
} else {
return false;
}


But i think i did something wrong, because it is not working.
I tryd it with this:
Code:
 

if(MakeClickableButton(3,GeneralToolbar_width+28,GeneralToolbar_height-52,"Test")){
show_message("Test");
}


The IfMousePos2 function:
Code:
 

GetMousePos();
if(global.mouse_x > argument0 and global.mouse_y > argument1 and global.mouse_x < argument2 and global.mouse_y < argument3){
return true;
} else {
return false;
}


I can see test, but if i press it nothing happend.
Does anyone got a working script like this?

Thanks,
Alexw
Edited by alexw, Oct 30 2010, 03:41 PM.
Offline Profile Quote Post Goto Top
 
DJ-Habana
C# King
[ *  *  *  *  *  * ]
Did you make use of the MouseCheck(...)
and these:
u3dcontroller.left_pressed etc.
Posted Image


Offline Profile Quote Post Goto Top
 
112 in actie
Member Avatar
Member
[ *  * ]
In your code, you select the width of the string, but not the height, so you check if your mouse is between x and x+width and y and y, where y is (of course) always te same, perhaps you should try string_height()?

Besides that, you now use argument1 (y) for the right side (x2), that should be argument0 (x)

Spoiler: click to toggle
Edited by 112 in actie, Nov 28 2010, 12:37 PM.
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
I don't see any mouse click actions so there's your problem.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply