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 / I Need Some Help With Basic Programming

Author
Message
Fuhrer
17
Years of Service
User Offline
Joined: 12th May 2008
Location:
Posted: 13th May 2008 04:11
Hello all, I'm in a sort of a dilemma. Programming with DarkBasic is a relatively new thing for me, so I find it rather hard. The only real programming background I have so far is with a TI - 83 since my school has a lot of them laying around...

Currently, I'm working on a kind of "Mad Libs" program and there's something I want to put into the program that I can't quite get right. I have all of the Mad Lib parts down (entering in nouns and such and then displaying them in a story), but I want to add a bit more to it. What I need help with is making something that randomizes which Mad Lib you'll go to after you see the title screen. I've tried doing a couple of things so far, but none of them have worked. Can anyone help me out here?
Not_Maindric
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 13th May 2008 14:42
Enter Randmize Timer() at the start of the program, then when you select a Mad Lib, put in rnd(**) [** is where you put how many there are.]

One thing with that though, 0 is also a possibility, so you also have to with make a Lib that is selected when 0 is also chosen, or in the **, make it one number less and make it rnd(**)+1.

**Off Topic**
Hm, a TI-83, eh? I used the same thing in Algebra, but then I bought a TI-84. They are both great calculators. =P

Invincibob 8
17
Years of Service
User Offline
Joined: 4th Feb 2008
Location: Some Place Somewhere
Posted: 2nd Jul 2008 20:35
Use a random variable and use a subroutine based on the number it lands on.

Example:


BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 2nd Jul 2008 22:33
Even though you are new, you can take a look at this, though it may be a little advanced. Try using file commands, such as load file. That way, you can just do this:

since I don't know the way your program runs, I couldn't give a more adequate name. Essentially it does the same thing every time, just from a different file (you will need to use OPEN TO READ for all of them). Another way is to OPEN TO READ str(filenum),1 which means that your files will need to be named 0 1 2 3 4 5 (and so on until you hit your max number).

Personally, I like doing it this way, but seeing as how you are new, you should probably stick with invincibobs approach for now, then, once you get that completely working, you can branch out to files.

BTW thanks for not being a noob and having a subject saying "NEED HELP PLZ" and then a body saying "Can someone help me?" Congrats, you actually told us how to help you, so thank you.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Invincibob 8
17
Years of Service
User Offline
Joined: 4th Feb 2008
Location: Some Place Somewhere
Posted: 3rd Jul 2008 07:32
Quote: "BTW thanks for not being a noob and having a subject saying "NEED HELP PLZ" and then a body saying "Can someone help me?" Congrats, you actually told us how to help you, so thank you."

BN2 Productions, you are very right, this person is one of the few new programmers that explained what they needed. There should be some type of reward for this.

Irojo
17
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 7th Jul 2008 20:53
Give Him a Cookie! (not the bad kind)


I have mad skills. I can make a dot follow your mouse in 2d. Don't try and tell me someone has done that before.

Login to post a reply

Server time is: 2025-06-05 23:41:35
Your offset time is: 2025-06-05 23:41:35