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 / Love Meter Program

Author
Message
Duderiza
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 18th Jan 2004 18:47
Hi Guys. This is going to be a lenthy piece of writing. I am making a love meter program, there are loads on the internet, but i decided to make my own. I want a certain letter to be worth so many points. I am not using input command as the text font is not too good. Instead i use this command to display a letter:

If inkey$()="a"
paste image 1,0,0
inc x,40
wait 60
endif

This is okay so far, if the "a" key is pressed then my small bitmap image is displayed, then if I press "n" key, a small bitmap image is displayed 40 pixels to the right of the previous letter. Now i want each bitmap to be worth a certain amount of points. I can do this. But if a user wants to delete a letter, then they have to press the "delete key". A black tile bitmap is then placed on screen removing the previous letter, by using "dec x,40" command. How would i get a command to delete the points for that letter from the total points. If they make a mistake in typing their name in the love meter, they will press the delete key then press the the letter they want, and it will be counting more points than it should, and i dont want it to do that.

I hope someone knows wot im talking about, and can understand this, and any help would be nice, and i would be grateful.
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 18th Jan 2004 19:08
whenever a key is pressed, add it to a string. When backspace is
pressed, remove the last character from the string. (using the LEFT$)
When the user presses enter, you use a FOR loop that adds all the "points" from the letters (using mid$) and displays the result.

Why do programmers always mix up Christmas and Halloween?
Because DEC 25 = OCT 31
Duderiza
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 18th Jan 2004 23:12
Hey Thanx TKFI5H. I was wondering could you work up a little exampl efor me, of you mean, and how i would use the LEFT£() command to delete the previous letter from the string. I would be thankful if you could.

Here is my code so far.

TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 19th Jan 2004 17:21 Edited at: 19th Jan 2004 17:36
Eek. It's huge...
I did some code optimisations, if you don't mind...


I didn't test this. I just typed it all in the browser. Should work...
[Edit]oops, I forgot to comment it...
And the command is LEFT$(). Being in Europe is no excuse for not using the dollar.

Why do programmers always mix up Christmas and Halloween?
Because DEC 25 = OCT 31

Login to post a reply

Server time is: 2025-05-22 14:13:39
Your offset time is: 2025-05-22 14:13:39