Page 1 of 2

Putting variables in the DRAW command.

Posted: Wed Dec 19, 2007 4:57 pm
by Sinuvoid
How do I do that?? I've tried doing,

Code: Select all

 DRAW "d",a"u",b etc.. 
and I've tried

Code: Select all

 DRAW "D" + a + "U" + b + etc...
Any suggestions on how to do that? If so thanks! :P

Posted: Wed Dec 19, 2007 8:02 pm
by burger2227
That would work a lot better using strings for variables.

DRAW "U" + A$

Where A$ is a string number. To convert any number to a string use the STR$(number) function:

A$ = STR$(number)

DRAW does not care about spaces so you do not have to trim it.

Ted

Posted: Wed Dec 19, 2007 10:21 pm
by Nodtveidt
How do you know that his a and b variables aren't strings already?

Posted: Thu Dec 20, 2007 7:51 am
by Sinuvoid
Because they dont include "$" :P Thanks for noticing anyways :)

Posted: Thu Dec 20, 2007 1:40 pm
by burger2227
Because your a JERK Nodvelt! That's why? Why else would Lee's code not work numbnuts?

Go finish your website! It is just another example of your laziness!

Posted: Thu Dec 20, 2007 4:12 pm
by Sinuvoid
Ok, don't go crazy people xD

Posted: Thu Dec 20, 2007 4:18 pm
by BadMrBox
Bring the paramedics. I think Clippy is having a seizure.

Posted: Thu Dec 20, 2007 10:14 pm
by Nodtveidt

Code: Select all

DIM A AS STRING
A = "Clippy has fleas"
PRINT A
Type suffixing is evil.

Posted: Thu Dec 20, 2007 11:57 pm
by burger2227
Most newer programmers do not DIM all of their variables, especially if they are just experimenting. There is absolutely nothing wrong with type suffixes. Look in any book on Basic!

As for the fleas, I must have got them from you! What kind of animal are you anyhow? They are easy to spot on my thin shiny body.

Still no code from Mr B I see. Call me a doctor!

Ted

Posted: Fri Dec 21, 2007 12:06 am
by Nodtveidt
burger2227 wrote:Call me a doctor!
You're a doctor.
burger2227 wrote:Most newer programmers do not DIM all of their variables, especially if they are just experimenting. There is absolutely nothing wrong with type suffixes. Look in any book on Basic!
That's a pretty gross assumption. You have no idea if a coder, even a "new one", has a background in C, for example, where type suffixes do not exist and are widely considered to be horrible style. Furthermore, I've probably read more books on BASIC than you ever will.
burger2227 wrote:As for the fleas, I must have got them from you! What kind of animal are you anyhow? They are easy to spot on my thin shiny body.
I'm a troll-eating dragon. But I generally use the thin ones like you as toothpicks.

Posted: Fri Dec 21, 2007 12:45 pm
by Sinuvoid
Nice Humor guys :P

Still with us, Lee?

Posted: Fri Dec 21, 2007 12:47 pm
by Mac
Lee wrote:Because they dont include "$" :P Thanks for noticing anyways :)
Uh, did you get your answer, Lee?

As burger2227 implied, you cannot have numbers, just strings.

Demo follows.

Mac

Code: Select all

SCREEN 1
LINE INPUT "Press Enter for demo"; e$
FOR i = 1 TO 10
  DRAW "d" + STR$(INT(RND * 5))
  DRAW "r" + STR$(INT(RND * 5))
  DRAW "u" + STR$(INT(RND * 5))
  DRAW "l" + STR$(INT(RND * 5))
NEXT i

Posted: Fri Dec 21, 2007 1:03 pm
by bungytheworm
Maybe moderators could remove all posts that does not handle about the topic itself?
Do we have moderators here?

Posted: Fri Dec 21, 2007 1:46 pm
by Sinuvoid
Yeah I got my answer,but I found a better solution and jsut use LINE. (Im making a library with buttons and text boxes etc.) But im having another problem and its with the COLOR and LOCATE command.

When I type

Code: Select all

CLS
SCREEN 13
LOCATE 2,5
COLOR 15,12
PRINT "Test"
it brings a a popup saying COLOR command stynax wrong or something :? What I'm I doing wrong?! And also when I use 0 it acts like its transparent...?

Posted: Fri Dec 21, 2007 2:19 pm
by Mac
Lee wrote:im having another problem and its with the COLOR
Unfortunately, each screen has rules about color. It's a pain.

SCREEN 13 only allows one operand. There is no way to change the background without stuff like OUT commands.

Mac

Code: Select all

CLS
SCREEN 13
FOR i = 0 TO 128 STEP 8
  FOR j = 0 TO 7
    COLOR i + j
    PRINT i + j;
  NEXT j
  PRINT
NEXT i
COLOR 7
P.S. As before, don't ask another question. Instead start a new thread for a new topic. You should have made a new thread about COLOR.

Posted: Fri Dec 21, 2007 2:21 pm
by Nodtveidt
The two-argument form of COLOR doesn't work with SCREEN 13. You can only specify the foreground color.

Posted: Fri Dec 21, 2007 2:22 pm
by Sinuvoid
Ok, but I think the PALETTE command is going to fix my problem. Thanks! And yeah Ill start a new thread next time :P

Posted: Fri Dec 21, 2007 2:25 pm
by Nodtveidt
You can set index 0 to be a different color, but that affects all the pixels of the "background" so that might not be what you want. Ultimately, what you probably would want to do is write your own text function if you want fancy text.

Posted: Fri Dec 21, 2007 2:28 pm
by Sinuvoid
Function? How is that going to make a differenc form doing it in teh main moduel?

Posted: Fri Dec 21, 2007 7:01 pm
by burger2227
Even if Lee had the background option, ALL of the background would be changed. However, with 256 color attributes, you can always change parts to other color shades using different attribute numbers.

PRINT will still have the default black attribute 0 behind the text however.

I have an interrupt Function that can change the text background color also.

Do I hear an echo in here or did N just tell you the same thing that Mac already said?

Ted