Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Buttons(I have seached) and Executing another program

Author
Message
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 22nd Aug 2007 21:30
Hello there. I am new here so please go easy. I have two questions. My first question is about buttons, i have searched but i havent got much good results. I then found a tutorial by TDK. I didnt really understand it thought. Can some one explain to me how to make one or possibly give me some code i can experiment with?. Basicly waht i need is just some buttons that i can place. From what i have learnt i will prety much have to put the button code in my loop wich is no problem. But i only got code with no description. TDK's tutorial did help a bit but he didnt really explain why it worked and how i would edit it for my needs.

My second question is Executing a program from my program. So say i have two program one called menue and other called game. So if i clicked the button on menue.exe in teh if statment i could like put somethnig like excute file "FileDir".

Sorry for my bad english.

Cheese Weesle,
Thanks

Hmm, how the hell do i do that?.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 22nd Aug 2007 22:15
Okay, after searching some mroe i found a way to execute a file from DBP. SO really its just the first qustion now im concerned about.

Hmm, how the hell do i do that?.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 23rd Aug 2007 04:16 Edited at: 23rd Aug 2007 04:19
To create a button, I use the following method...

1. Create a 1x1 sprite, hide it, and position it at the mouse's position each frame.



2. Create your button.




3. Check for a collision between the sprite at your mouse and the button sprite. If it returns a 1, then your mouse is over the button.



And that's it! You can of course use your own image for the button. Also, to check if you've clicked the button, just change

IF SPRITE COLLISION(1,2) = 1

to

IF SPRITE COLLISION(1,2) = 1 AND MOUSECLICK() = 1

I hope that helped. If you have any questions, I'd be happy to answer them.

--This is where my sig would be if I had the energy to make one...--
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 23rd Aug 2007 10:09
You can also do it without sprites. Note that these two methods both have their good and bad sides. Choose which one you like most . I prefer an method where I use an sensetive area (I just check if the mouse are greater then thisXCoordinate and smaller then anotherXCoordinate, and then I do the same with the y coordinates). It's quite easy. Lets say we want to have an button 'Play'. The first thing we want to do is to get the position of the mouse.

A good thing is to store the positions in variables. Lets just call the variable that stores the x position of the mouse for 'x', and the variable that stores the y position for 'y'. So now we got the code:

Now this code can't do much. We may want some text to. Lets say we want it in the x coordinate 5 and y coordinate 17 (just picked two numbers, you can choose whatever coordinates you want). To do this, we can use the 'text' command. Code:

To make an button out of this, you'll need two very handy commands:

We want the button to react if the mouse is over the text. This meens that the x coordinates of the mouse must be heigher or equal to the x coordinate where the text starts (5) and smaller or equal to the width of the text + the x starting position(5 + text width( someText )). To do that, we can use the code:

And to make sure it's in the button we must do the same thing on the y coordinates:

Now we pull this toughether with our other code, and then add so the text 'Your mouse is over the button' appears somewhere on the screen if the mouse is over the text.

Note that I put the code where you detect if the mouse is over the text above where I draw the text. This is because then you will be able to change the color of the text if you want much easyer, but I won't tell you how here. Also note I've added an new command at the top, 'cls'. This will clear the screen.
Now we may want to detect of the button is pressed. There are one other command for that:

We add this command inside the code where we detect if the mouse is over the text.

You can also make so it will only display 'Your mouse is over the button' if the button isn't pressed:

This is how you can create an button with just some text commands. I hope you've found it usefull. Note that it might seem clumsy in this form, but if you, like I do, create an function out of it, it will be very dynamic. If you don't know what an function is, I suggest you look it up, becuase they are very good to work with.

And one thing more. Welcome to the forums.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 23rd Aug 2007 11:39
Thanks so much!!!!, i have made a button and it works!. Now i get get on with my menue.

Hmm, how the hell do i do that?.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 23rd Aug 2007 17:10
Okay, now i was just making a quick text game testing my menue method. And i accidently click sumit and all the colour on my text goes. How do i get it back?

Hmm, how the hell do i do that?.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Aug 2007 21:09
Honestly, I really do despair sometimes...

Quote: "Can some one explain to me how to make one or possibly give me some code i can experiment with?"


What on earth do you think all those little white boxes with the words 'Code Snippet' in the tutorial are?

AndrewT

The code you supplied does the same thing as the code that was in the tutorial he says he has read! So, it's beyond me why he can follow what's going on with your code but not the tutorial.

My guess is that he's not even read the tutorial as it was more than 20 words and he just wants the code to paste into his program without learning what it does.

Quote: "And i accidently click sumit and all the colour on my text goes. How do i get it back?"


If you actually read the beginners tutorials and tried to learn something you would be able to sort out simple problems like that yourself.

If all you want is for others to post code for you to paste into your programs, you will soon find that I and many others will refuse to help you.

TDK_Man

Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 23rd Aug 2007 21:50
Quote: "My guess is that he's not even read the tutorial as it was more than 20 words and he just wants the code to paste into his program without learning what it does."


I thought that this would be a nice place but instead you complain that i can read more than 20 words and i want to just copy and past code?!?!?!?!.

Well actualyl all on my own i made a 3d program. And im glad i did not need your help, TDK.

Hmm, how the hell do i do that?.
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 23rd Aug 2007 23:03
Chill mans, TDK was only trying to help you. People around here don't like other people asking for code to paste. There's code snippets and tutorials to learn from.

Everyone here helps each other, but part of programming is figuring stuff out for yourself, and I can see that you did that, so good job.
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 23rd Aug 2007 23:51 Edited at: 23rd Aug 2007 23:52
Comment Removed

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Aug 2007 01:40
Quote: "I thought that this would be a nice place "


It is, but only if you have the right attitude.

Quote: "you complain that i can read more than 20 words and i want to just copy and past code?!?!?!?!"


You should read what I said again. You missed three vital words - 'My guess is'.

The reason I said that was simply because you said you wanted code to experiment with. There is working code in that tutorial and the text of the tutorial does explain what the code does.

I can therefore only assume that you didn't read it and that you do only want someone to give you code to do it.

Why then, when someone pastes the code here which does the same as the code in the tutorial, do you then understand it?...

If something in any of my tutorials isn't clear, then anyone can post asking for clarification in the thread and if necessary I'll add to the tutorial to improve it. You didn't do this.

My last statement may well have been blunt, but it was true.

Newcomers need to read the help files and the beginners tutorials to get the basics. One you have this, everyone here will be only too happy to help out with the harder stuff.

TDK_Man

Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 24th Aug 2007 12:00
Quote: "You should read what I said again. You missed three vital words - \\\'My guess is\\\'.

The reason I said that was simply because you said you wanted code to experiment with. There is working code in that tutorial and the text of the tutorial does explain what the code does.

I can therefore only assume that you didn\\\'t read it and that you do only want someone to give you code to do it.

Why then, when someone pastes the code here which does the same as the code in the tutorial, do you then understand it?...

If something in any of my tutorials isn\\\'t clear, then anyone can post asking for clarification in the thread and if necessary I\\\'ll add to the tutorial to improve it. You didn\\\'t do this.

My last statement may well have been blunt, but it was true.

Newcomers need to read the help files and the beginners tutorials to get the basics. One you have this, everyone here will be only too happy to help out with the harder stuff.

TDK_Man"


Its a bloody good thing i havent ordered DBP yet. And now i am not going to. If all the mods are like this then what are the normal people like?. And its never had a comercial product in 10 years. I think that explains.

Also my guess is: that your a mod so you think your higher than evrey one else. You think can boss them around, get them to do what every you want. Well not!, im not taking shiyt from you man. Nope not me. Now good bye.

And to the rest of the people here, why are you wasting your time?. Go and learn something worth while.

Hmm, how the hell do i do that?.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 24th Aug 2007 19:34
Quote: "And its never had a comercial product in 10 years."

You're wrong there friend.

Quote: "your a mod so you think your higher than evrey one else. You think can boss them around, get them to do what every you want. "

TDK bossed people about long before he was a mod

TDK has spent many hours writing very good tutorials. I can understand the mans exasperation when people don't make the effort to study them properly. And, let's be honest, if you had studied TDK's tutorial thoroughly then you would be able to code a button routine with ease.


The word "Gullible" cannot be found in any English Dictionary.
Penfold
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 24th Aug 2007 20:02 Edited at: 24th Aug 2007 20:06
Quote: "Its a bloody good thing i havent ordered DBP yet. And now i am not going to."


Frankly if that was enough to frustrate you enough to not bother then you probably wouldn't have lasted long anyway.

Another one bites the dust.

Being critisised is part of the evolotion of a game. If someone doesn't tell you your doing something wrong or theres a better way of doing it, we'd still be playing pong on black and white tv's if this was the case.

Believe me if I had that kind of attitude the first time my boss said my program needed to improve, I would have had to resign. (btw I program industrial robots )

'Ooh 'eck chief'...'crumbs'
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 24th Aug 2007 20:44 Edited at: 24th Aug 2007 20:46
Quote: "Also my guess is: that your a mod so you think your higher than evrey one else. You think can boss them around, get them to do what every you want. Well not!, im not taking shiyt from you man. Nope not me. Now good bye."


Calm down, man. TDK's words might have been harsh, but in this case, he's right. I suggest you try to read what he acually writes rather then how harsh his ways of putting it is . And beyond that, I don't think he was THAT harsh. You're overreacting.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 25th Aug 2007 00:06
Okay im willing to give this another go. Aslong as TDK dosent try boss me around and claim i cnat read 20 lines i have writen a game story that was 486 lines long.

Quote: "Quote: "And its never had a comercial product in 10 years."
You're wrong there friend.
"


What?!?!?!?!?!, i thought there was never one thats what most people said. Prove me wrong


Quote: "Quote: "Its a bloody good thing i havent ordered DBP yet. And now i am not going to."

Frankly if that was enough to frustrate you enough to not bother then you probably wouldn't have lasted long anyway."


Im usually very patient when i know i have to do something, but at this moment in my life thinfs are very stressfull.

Quote: "Calm down, man. TDK's words might have been harsh, but in this case, he's right. I suggest you try to read what he acually writes rather then how harsh his ways of putting it is . And beyond that, I don't think he was THAT harsh. You're overreacting. "


Well maybee they were written in perfect english and very good grammer. But not evrey one who is foreighn knows good english. And id prefer it to talk us through the code line by line and explain what evreything in the line did and what it was for. Instead in just tells me what it does(Not explaining how to use it if i wanted to) and moves onto something compleatly diffrent.

Hmm, how the hell do i do that?.
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 25th Aug 2007 00:59 Edited at: 25th Aug 2007 01:00
Quote: "If all the mods are like this then what are the normal people like?."


Well, if you think TDK was harsh, you probably should just go buy a book or something.

This is a community of people, and when you ask for help from them you'll get it. Look at posts 3-6, you were getting help. TDK was trying to help you too. Whenever someone posts a buttons thread (which has been posted many, many times), he gets upset because he's a mod, and he also gets upset because he has written a tutorial on it and thinks you have neglected to use the search button. You gotta understand that man, he was only trying to help you.

So if you want to learn DB, take criticism from people, because it's only constructive. All this forum is for is help. Like Penfold said, if no one told us how to improve, well, we probably wouldn't even have TVs.
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 25th Aug 2007 10:41 Edited at: 25th Aug 2007 10:42
Glad to hear you give this a try. Because we really have tried to help you. Even TDK did.

Quote: "What?!?!?!?!?!, i thought there was never one thats what most people said. Prove me wrong"


Start Wraith, Riftspace and Evochron are three examples:http://starwraith3dgames.home.att.net/go.htm

Quote: "Well maybee they were written in perfect english and very good grammer. But not evrey one who is foreighn knows good english."


I didn't meen that it was perfect english with perfect grammar. My point was that some times you focus so mush on what you think people say that you miss what they are actually saying. I've done that misstake several times, so I know. Once I asked this question, and when I looked at what they resopnded I thought they said that I shouldn't have asked that. But later, when I read it, I realised that I was wrong. They had just answered my question.

The one thing worse then the brutality of the evil, is the iggnorance of the god.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 25th Aug 2007 12:13
Quote: "Quote: "Quote: "And its never had a comercial product in 10 years."
You're wrong there friend.
"

What?!?!?!?!?!, i thought there was never one thats what most people said. Prove me wrong"


http://www.focusmm.co.uk/shop/Teaching-you-Touch-Typing-Version-2.0-pr-1181.html

http://www.focusmm.co.uk/shop/Driving-Test-Success-ALL-TESTS-Deluxe-2007-08-Edition-pr-1209.html

Both of these can be found on the shelves in PC world.


The word "Gullible" cannot be found in any English Dictionary.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 25th Aug 2007 12:18
Quote: "Start Wraith, Riftspace and Evochron are three examples:http://starwraith3dgames.home.att.net/go.htm"


Yea, but Starraith and Riftspace come free with DBP and i dotn know about Evochron so im here to stay.

Quote: "his is a community of people, and when you ask for help from them you'll get it. Look at posts 3-6, you were getting help. TDK was trying to help you too. Whenever someone posts a buttons thread (which has been posted many, many times), he gets upset because he's a mod, and he also gets upset because he has written a tutorial on it and thinks you have neglected to use the search button. You gotta understand that man, he was only trying to help you."


I understand that but sometimes my english is a bit bad and i do not understand evreything. Looking back at it i notice it explains just as good. But i dont allways understand as good becouse im not english. I am sorry TDK.

Hmm, how the hell do i do that?.
Roxas
18
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 25th Aug 2007 12:31
And dont forget Firewall

[center]
Penfold
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 25th Aug 2007 15:24 Edited at: 25th Aug 2007 15:25
Quote: "Yea, but Starraith and Riftspace come free with DBP and i dotn know about Evochron so im here to stay."


but both were available to buy a long time before they were added to the DBP pack.

I know as I purchased one myself.

Its much the same as the old sinclair spectrum magazines, when a game had been out for some time then it would be included on a cover tape *free* with the magazine. Both of these games are EPIC's in there own way, both giving inspiration to new coders.

Several other FREEWARE games have also been released, these giving the player a cut down version of the complete game with limited play time or levels. Then the player is given the chance to buy the full product. Making these also a..

Quote: "comercial product "


'Ooh 'eck chief'...'crumbs'
Lee Stevens
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Deep in code...
Posted: 25th Aug 2007 15:33 Edited at: 25th Aug 2007 15:33
cheese i had the same problem you should read TDK's tutorial, you should read it then you will learn how the buttons work, if you just ask for the code people get annoyed (trust me on this i have ask for code loads of times)

SPECIAL OFFER ON MY WEBSITE
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 25th Aug 2007 19:54
Quote: "Looking back at it i notice it explains just as good. But i dont allways understand as good becouse im not english. I am sorry TDK."


Well, glad to see we're all happy again. Who wants cake?
Penfold
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 25th Aug 2007 20:07
Battenberg for me PLZ

'Ooh 'eck chief'...'crumbs'
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 25th Aug 2007 20:33 Edited at: 25th Aug 2007 20:40
I wonder how long this is gonna go on before being locked.

I say the MODs DON'T lock it, because that would be quite funny.

P.S. - Like my new avvy? Just made it in Flash lol.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 26th Aug 2007 11:27
P.S. - Like my new avvy? Just made it in Flash lol.


Its cool, but you can quite see whats going on

Hmm, how the hell do i do that?.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 26th Aug 2007 15:16
Got a problem when programing, can any one tell me if i use open to read ,"". Then can i use Read file to get the integear value out of it. It dosent explain very well in the manual.

Hmm, how the hell do i do that?.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 28th Aug 2007 10:37
Okay small problem, im in my 3d world ive just finished messing with ghost object for my water and then i try to print stuff on the screen like health. Thinking that Health is a variable. Then why wont Text 50,50,Health work it gives an error about its format. Now so when i use print the etxt just sinks to the bottom of the screen and i cant control were it goes.

Hmm, how the hell do i do that?.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Aug 2007 10:56
If you check the manual, you will see that the Text command is only for printing strings.

If you want to use numeric variables with it, you have to convert them to strings first with Str$():

Text 50,50,Str$(Health)

TDK_Man

Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 28th Aug 2007 13:04
Thanks TDK that helped alot. I have my 3d game now with controls and a world with text on screen displying health mana and money. Now the problem is i can just walk through the terrain. I searched for collision and evrey one seems to say that collision that comes with DBP is not very good. So i found something called Sparkys collision dll. Can any one tell me if terhe is an easyer way of collision or mroe sufficiant way?. Im gonna go search on how to use it now.

Hmm, how the hell do i do that?.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Aug 2007 19:33
Quote: "I searched for collision and evrey one seems to say that collision that comes with DBP is not very good."


True, but only if you want complicated, fast and extremely accurate collision. It depends on what you want to do.

For maybe 90% of newcomers, DB's built-in collision is perfectly good enough. All I'm saying is try the built-in collision and if it doesn't do what you want then by all means use a plug-in. Don't just use Sparky's because someone else says the built-in collision is crap - it's not. It's just not as good as it could be.

If you can't do what you want with DB's collision, you'll probably struggle to do the same thing with Sparky's.

Tutorial 10 - Dark Basic Collision Made Simple

Quote: "Now the problem is i can just walk through the terrain. "


What sort of terrain? If it's a matrix then the function to use is called Get Ground Height().

TDK_Man

Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 28th Aug 2007 19:59
Quote: "Quote: "Now the problem is i can just walk through the terrain. "

What sort of terrain? If it's a matrix then the function to use is called Get Ground Height()."


Thanks TDK for teh info. Its a loaded x model i made.

Hmm, how the hell do i do that?.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Aug 2007 23:01
Quote: "Its a loaded x model i made"


In that case it is collision you want - not Get Ground Height - and DB's built-in collision should be OK for what you need.

But feel free to have a play with Sparky's plug-in too if you like...

TDK_Man

Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 30th Aug 2007 00:27
After searchign it seems like there is two options for a very big game. Use Sparkys or Nuclear glory. Now what it seems like is that NGC is very easy to use but will cut alot of my fps. But sparkys may be more complicated but wnat chop big jucy chunks of my fps. Im gonna go test sparkys now.

Hmm, how the hell do i do that?.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 31st Aug 2007 00:41
Im also gonan give BSP a try see if thats any good.

Hmm, how the hell do i do that?.
Cheese weesle
17
Years of Service
User Offline
Joined: 22nd Aug 2007
Location:
Posted: 1st Sep 2007 20:39
Okay i have my very big terrain made in ted. But know comes the point were i need to use Sparkys so i searched but couldent find uch on it that explained the simple basics of it. Only complicateed collision. Could soem one link athread or explain how Sparkys works?.

Hmm, how the hell do i do that?.
dark donkey
18
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 2nd Sep 2007 16:59
'Colision
Set object collision to polygons OBNUM
automatic object collision OBNUM,radius,flag

the flag can be 0 or 1. if its 0 then you just stop when you colide with the obejct if its 1 you wil slide up/across it. Hope this helps ya.

Login to post a reply

Server time is: 2024-09-27 05:11:26
Your offset time is: 2024-09-27 05:11:26