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.

DarkBASIC Discussion / 3 how to questions please help...

Author
Message
highschool gamedude
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 19th Oct 2003 08:50
i have three questions ...:

1. how do you open and save functions, variables, etc to text files

2. in codes with stuff like if scancode()>0 if mouseclick()=1 etc you can just hold down a button... like i am trying to make it where if you click at the right time something happens how do you make it where you cant just hold down the button?

3.i am also trying to make something where you click on a sprite to trigger something and i coded something like:
if mouseclick>0 and mousex()>c and mousex()<c+82 ...etc etc

where c is the x placement of the sprite and 82 is the width
it only responds to the clicks sometimes...




ps i probably wont read this again til the morning as i am about to go to sleep... lol it is almost morning anyway..and i have been gettin up really early lately to help my dad with a milk route which takes around 12 hours... but that is a different story..but anyway good night and thanx in advance

any tips (i just started with this program)
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2003 11:29
2. in codes with stuff like if scancode()>0 if mouseclick()=1 etc you can just hold down a button... like i am trying to make it where if you click at the right time something happens how do you make it where you cant just hold down the button?


You create a variable that holds the last value of mouseclick(). You do the action, then don't do it again until mouseclick() becomes 0 again. Here's some sample code, it's scarily easy once you see it...



BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
thinkdigital
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 19th Oct 2003 20:39
Opening and saving variables and such to text files is quite simple. Use the open to write command. Here, check out this code snippet, and you'll get the idea:
http://thinkdigital.home.att.net/snippets/snip12.txt

Hope I was able to help you.

Gentlemen, your physics books were wrong. All of everything consists of two elements: me and the computer.
thinkdigital
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 19th Oct 2003 22:55
In most of my programs, I use the sleep command after the mouseclick() or scancode questions. I give it a little value, like 20. Then, after the keypress or click, the program delays only momentarily. But that does keep an pressing of clicking after it ignored. It works great, try it ! Here's the code from my program:


Gentlemen, your physics books were wrong. All of everything consists of two elements: me and the computer.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 20th Oct 2003 07:22
The problem with a sleep comand is it pauses the ENTIRE program, so if something is loading, it will stop, only momentaraly, i agree, but you will notice it...

I suggest using BatVink's code...

Knowledge Belongs To The People...

Login to post a reply

Server time is: 2025-05-21 14:56:52
Your offset time is: 2025-05-21 14:56:52