This site is no longer active and is available for archival purposes only. Registration and login is disabled.

BASIC Help


BASIC Help

Postby Caesar » Aug 26, 2004 @ 4:04pm

Here's my very basic code dealing with the random number generator. I want it so that when the user inputs break or Break the app will jump to label 2 and then end itself. However, all it does is add a random number to the end of Break. Also, the random number generator appears to only create a random number > .0. Any ideas?

Here's my code:

Label 1
randomize 1
input A
if A=Break|break then goto 2
A=A+RND
print A
goto 1

label 2
end

| means "or"
Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby refractor » Aug 26, 2004 @ 4:17pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby David Horn » Aug 26, 2004 @ 4:24pm

Crosswind technique: "Using your peripheral vision, react to body movements, gasps, groans, and shouts from the other side of the cockpit, and always remember that it's better to be lucky than good."
User avatar
David Horn
<b>The Boss</b>
 
Posts: 1867
Joined: Feb 17, 2002 @ 2:10pm
Location: PocketGamer Towers (New York, Paris, Leeds)


Postby Caesar » Aug 26, 2004 @ 4:40pm

Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby Jinks » Aug 26, 2004 @ 4:51pm

INPUT A
PRINT A,Break,break

RUN see what you get, guessing 0,0,0.

Find out what your dealing with. Suspect Break=0 as a default setting for initialising the variable. It'll be an ASCII(4 maybe EOD) value or more likely default to zero again if not set. You've got the whole INKEY or KEY and build your own input emulator if it won't tell you Break. Better way is $ input and check ="" or else EVAL.

In most basics with a fractional RND.
num=((13-6)*RND)+6
to get 6<= num <13 results
The stylus is mightier than the pen!
jinks
User avatar
Jinks
pm Member
 
Posts: 281
Joined: Feb 21, 2004 @ 1:57am
Location: Croydon, UK


Postby Caesar » Aug 26, 2004 @ 4:56pm

INPUT A
PRINT A,Break,break


returns: 0 0
Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby Jinks » Aug 26, 2004 @ 5:00pm

So you hit break on the INPUT a and it returned nothing. Haven't seen behaviour like that since the Sinclair QL automatic string-numer thing which had a very technical term.

Can you
INPUT A
IF(A="") PRINT "Batman"

See if it spits on the "".
The stylus is mightier than the pen!
jinks
User avatar
Jinks
pm Member
 
Posts: 281
Joined: Feb 21, 2004 @ 1:57am
Location: Croydon, UK


Postby Caesar » Aug 26, 2004 @ 5:04pm

I had to add a "then" to it otherwise it refused to let the PRINT come on the same line after the IF.


Here:

INPUT A
IF A="" THEN PRINT "Batman"

Returns: Batman
Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby Jinks » Aug 26, 2004 @ 5:09pm

The stylus is mightier than the pen!
jinks
User avatar
Jinks
pm Member
 
Posts: 281
Joined: Feb 21, 2004 @ 1:57am
Location: Croydon, UK


Postby Caesar » Aug 26, 2004 @ 5:16pm

Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby Jinks » Aug 26, 2004 @ 5:26pm

The stylus is mightier than the pen!
jinks
User avatar
Jinks
pm Member
 
Posts: 281
Joined: Feb 21, 2004 @ 1:57am
Location: Croydon, UK


Postby Caesar » Aug 26, 2004 @ 5:31pm

Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby Jinks » Aug 26, 2004 @ 5:45pm

The stylus is mightier than the pen!
jinks
User avatar
Jinks
pm Member
 
Posts: 281
Joined: Feb 21, 2004 @ 1:57am
Location: Croydon, UK


Postby Caesar » Aug 27, 2004 @ 2:49pm

Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though--it'll try and slide away from you the first chance it gets.
User avatar
Caesar
Veni Vidi Vici
 
Posts: 3901
Joined: Jun 24, 2003 @ 5:24pm


Postby Jinks » Aug 27, 2004 @ 4:19pm

The stylus is mightier than the pen!
jinks
User avatar
Jinks
pm Member
 
Posts: 281
Joined: Feb 21, 2004 @ 1:57am
Location: Croydon, UK


Return to Anything Discussion


Sort


Forum Description

Post all off-topic messages here, almost anything goes.

Moderators:

Dan East, sponge, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron