ChatterBox

BlitzPlus Forums/BlitzPlus Beginners Area/ChatterBox

Yo! Wazzup?(Posted 2007) [#1]
I've decided to work on a small project but I'm new at programming and don't know exactly how.

I want this to be a small chatroom for 2 people and it might look like this to the user.


Global theirmessage$="Okay."
.start
message$=Input("")
Print "You: " + message
Delay 2000
Print "Other Person: " + theirmessage
Goto start


(message$ = "Let's Play!")


I would not like the line: Global theirmessage$="Okay.",
instead I would like it to be a message that the other person sent.


If you have questions or have some code I could use, please reply.

Type #765906 after everything in the browser url to go to the bottom of the page.


CS_TBL(Posted 2007) [#2]
If you're new: start at the very beginning. Starting at the beginning means starting with small and dumb programs, thousands of 'em, and if you're done: do another thousand of 'em.

A program to chat would not exactly look like that example code, in fact you can't even really imagine what it would look like, therefor you need to start at the beginning of the learning traject.

The first thing to get rid of is using gotos and labels. I assume you've come from QBasic or something? Blitz is more like C/Pascal using Basic-flavor.

I assume you're using B+ ? You might have to investigate some time reading about events. You might also actually do good by joining reading siopses' learning traject, that saves us from explaining the same things twice .. :P


Yo! Wazzup?(Posted 2007) [#3]
I use Blitz3D for programming, and started with Visual Basic. I can't even remember how to program in Visual Basic anymore.

I read:
Game Programming For Teens Second Edition by Maneesh Sethi
and 3D Game Programming For Teens By Eric D. Grebler.


CS_TBL(Posted 2007) [#4]
Uhm right. So you don't have/use B+? This *is* the B+ section you know. :P While the 2d-part isn't realy different, you *can* expect people here to reply with eventbased- and GUIbased solutions. So whether that's handy..?


Yo! Wazzup?(Posted 2007) [#5]
I can still post here, I mean this is Blitz+ stuff, and I don't want to annoy people who make 3D things.

(unless I want 3D text, which I don't.)
Do you want me to post this in the Blitz3d section? 'Cause they'll just get mad at me and tell me I should of posted in the blitz+ section.


CS_TBL(Posted 2007) [#6]
Ofcourse you can post here, you can prolly also post in the blitzmax section. But B3d is typically used for games afaik, give or take the few who make a custom GUI-system. A chatbox -unless you want it integrated into a game- is usually more like a GUI thing.

BTW, being called "blitz3d" doesn't mean it doesn't do 2d eh.. I'm sure you can ask anyone there for 2d-based solutions. (and otherwise tell 'em they're a buncha wankers :P)
Acually it's said that for 2d, B+ is even faster than B3d. You might best ask yourself whether B+ could be handy for you, if you've any interest in non-games, or editors for games, B+ might be an option for you..


Yo! Wazzup?(Posted 2007) [#7]
You know, I'm only 9, and I don't have enough money.
I'm lucky I actually got $100 and still have some left over.


CS_TBL(Posted 2007) [#8]
Ok then, forget the 'wankers' word ^___^

Ok, well, if you have to start from scratch: just start with fluffy little programs and happy little experients, and beat the devil out of it. I'd put the idea of this chatbox on the shelves for a while.

If you have 2d questions you can ask them in both sections I guess, do note that I still think that an event-based language like B+ is a better option than a polling-based solution like B3d, but that might be a matter of taste.

Do realize that all the experience coders here all had a very long learning traject, and they know it will take time, and they will recognize when someone is asking things that require a far longer learning traject first. So again I'd advice to take small steps first (no pun intended ^_^) and gradually work towards bigger programs!


Yo! Wazzup?(Posted 2007) [#9]
I know, I know. I'm just not patient.
I'll come back to this topic tomorrow. I guess I'll go post in the Blitz3D section.


CS_TBL(Posted 2007) [#10]
Learning to program requires patience, a LOT of patience, and then even more patience. If you try to run too fast then you'll fall, guaranteed! Since you're only 9, you've time enough left to learn to be a good programmer.

See, atm I'm 29, I got my first homecomputer when I was around 11 orso, an MSX1, with a built-in BASIC like the old GW-Basic. Next -aged around 17- I got a PC and started with QBasic, around 2000 I started with B3d, around 2003 orso I started with B+, and end 2005 I started with Blitzmax. I'm not a fulltimer on programming but I do spend some time on it, and I still have quite a bunch to learn yet. But I don't rush things, I've made thousands of small dumb programs, and only recently I think my stuff gets better structured. So, that's after 18 years! Of course I won't superimpose myself on all other programmers, there're have been ppl who did miracle things in assembly after only 5 years of experience. Sofar, me and you can't predict what kind of person you are, like me, or like those wizzards.


Yo! Wazzup?(Posted 2007) [#11]
Yeah... I try to make small, dumb programs, but I can never think of any. I can say my best program is this one:








You want to hit the red sphere.



Can you give me some ideas of what programs to make without giving me the code? That would really help.


CS_TBL(Posted 2007) [#12]
Could do, but I'll start easy then.. (hopefully :P)

Create a 64x48 grid on screen using 2x2 dots on the junctions, so like:

::::
::::
::::

etc. but then regular distance eh.

Each such 'cell' must be 8x8 pixels.
You must hoover the mouse over the whole and be able to click cells with the left mousebutton. When you clicked an empty cell, you "fill" it with a color of your choice (e.g. white, red, purple etc.). When you click a filled cell you empty it again.

That's all, it's like a drawing program for visually impaired so to say..

'ave fun :P


Yo! Wazzup?(Posted 2007) [#13]
uhhh... I'm not that advanced. I can't make a grid...
Like I said, I'm only 9...


CS_TBL(Posted 2007) [#14]
Then we start with the grid first, you've seen my ascii art, you could understand that a grid is like mathpaper for school, right, (mmm.. maybe you don't have math yet ^_^), only not with lines but with single pixels .

So, this is ordinary mathpaper (and basically also a kind of grid):
|_|_|_|_|_
|_|_|_|_|_
|_|_|_|_|_
|_|_|_|_|_
|_|_|_|_|_


And here's what I mean:
. . . . . . . 
. . . . . . . 
. . . . . . . 
. . . . . . . 
. . . . . . . 

etc.

Can you just draw that in B3d? Hint: there's a "Plot x,y" command you might want to read about in the help.


Blitz123(Posted 2007) [#15]
Like, to give you a bit of a clue:

Plot 1,1

Would Plot a point at 1,1 on the screen.You would then use loops to do the entire grid, so you dont have to write out thousends of plot commands.


Blitz123(Posted 2007) [#16]
To give you more clues, you also need to use this command:

Graphics x,y
at the very start of the program. This makes the screen ready for graphics. The x and the y tell the computer how big you want the screen. Most important command in Blitz!


Yo! Wazzup?(Posted 2007) [#17]
I'm not so good at programming, do the cells have to be 8X8 pixels?


Blitz123(Posted 2007) [#18]
No. Of course not.


Yo! Wazzup?(Posted 2007) [#19]
No. Of course not.



You didn't make the assignment. I'ts CS_TBL's choice.


CS_TBL(Posted 2007) [#20]
well, 8x8, 12x12, 6x6, 20x20, if you can draw a cell of one size, you can make them any size.


Yo! Wazzup?(Posted 2007) [#21]
I'll try to get it in tomorrow.
I have this so far:
Graphics 800,600,0,2
Global x=5
Global y=5
While Not KeyDown(1)
Plot x,y
y=(y+5)
If y => 320 Then
y=320
EndIf
Wend



CS_TBL(Posted 2007) [#22]
Ok, you know what, we'll skip the rest for the first days or so, let's first make the "Ultimate Grid Function (tm)". So we're only going to make a grid, in its most ideal form, and that's it.


CS_TBL(Posted 2007) [#23]
Read the manual for the command: "For"

Actually I'm not quite sure how to explain all this to a 9yo, I can't remember anymore what I was calculating back then in class. In the most ideal case I refrain to giving a few hints and let you discover the rest yourself. But I'm not sure if I can ask that of you.. :)


Yo! Wazzup?(Posted 2007) [#24]
I was gone for a few hours and just got to this:

Graphics 800,600,0,2
Global x=5
For y=5 To 320 Step 5
Plot x,y
Next
For x=5 To 240 Step 5
Plot x,y
Next
Delay 5000
End


When I do something wrong, I can't close the window and I have to open up Task Manager and do it from there... And when I close the window with Task Manager the IDE shuts down and I didn't have time to save...


CS_TBL(Posted 2007) [#25]
And as you see you only got one row and one column.

let's place another hint:, imagine each dot is a number:

00 10 20 30 40 50 60 70 80 90
01 11 21 31 41 51 61 71 81 91
02 12 22 32 42 52 62 72 82 92
03 13 23 33 43 53 63 73 83 93
04 14 24 34 44 54 64 74 84 94
05 15 25 35 45 55 65 75 85 95
06 16 26 36 46 56 66 76 86 96
07 17 27 37 47 57 67 77 87 97
08 18 28 38 48 58 68 78 88 98
09 19 29 39 49 59 69 79 89 99


Now what would you do to create these numbers? It's exactly the same as creating a grid. As you can count, these are 100 values, 100 = 10x10.

Your turn :P


Yo! Wazzup?(Posted 2007) [#26]
Graphics 800,600,0,2
Global y=5
While Not KeyDown(1)
For x=5 To 240 Step 5
Plot x,y
Next
y=(y+5)
If y=>320 Then
y=320
EndIf
Wend
End




?????????????????????????


CS_TBL(Posted 2007) [#27]
ok, I think you need a hand here: you can nest a for loop
For x=0 to 9
  For y=0 to 9
    plot x*10,y*10
  Next
Next


It's not entirely the perfect way, but first toy with this for a while.


Yo! Wazzup?(Posted 2007) [#28]
this not right?


Yo! Wazzup?(Posted 2007) [#29]
Graphics 1024,768,0,2
Global y=10
While Not KeyDown(1)
For x=10 To 480 Step 10
Plot x,y
Next
y=(y+10)
If y=>640 Then
y=640
EndIf
Wend
End







this?


Yo! Wazzup?(Posted 2007) [#30]
ok, that is easier. Mine does take up more coding space.
...But you never told me plot supported *. I guess you didn't need to... But my code still works!


CS_TBL(Posted 2007) [#31]
It's not the correct way to do. Because you keep drawing, even when y is clipped to 320 it still keeps on drawing. Using the for-loops the grid is drawed only once, and 'once' is all you need, and also: 'once' is preferred in the world of programming.


Yo! Wazzup?(Posted 2007) [#32]
right...


CS_TBL(Posted 2007) [#33]
* + - / ^ is just math. I assume you got those math sums at school already? Every numerical value in a programming language can be changed using numerical instructions, such as * + - etc.

So, one could also type:
For a=10/5+9 to 99*4-4/2+49

Ok, doesn't make sense, but it works.


Yo! Wazzup?(Posted 2007) [#34]
I know how to do math. I love math! I already know that + is add, - is subtract, * is multiply, and / is divide.

Oh, and that For thing you did was really this:
For a=11 To 245


CS_TBL(Posted 2007) [#35]
Ok, then you have at least the most essential ingredients ready.

Just to complete your knowledge: ^ is power, 2^3 means: 2*2*2. 6^5 means 6*6*6*6*6 .. but I don't think you'll be needing this for the first coming years. (after a while you can impress your classmates with all this extra info :P)


CS_TBL(Posted 2007) [#36]
actually, those numbers were: 11 and 443 :P There are priority rules to follow: first: ^ then * then / then sqr then + then -

sqr is the reversed of power

sqr(16) = 4, because 4*4 = 16
sqr(100) = 10, becaus 10*10 = 100

etc.

You can force priority using round brackets btw.
like: 4*8-1 = 31, but 4*(8-1) = 28


Yo! Wazzup?(Posted 2007) [#37]
yeah, I knew what power was, and I'm in the smart math class so that wouldn't impress too many people, but I didn't know that ^ meant power. Woo-hoo! I learnd something over spring break! Yeah!


Yo! Wazzup?(Posted 2007) [#38]
Hey, what is your screen size?


CS_TBL(Posted 2007) [#39]
1280x1024, why?


Yo! Wazzup?(Posted 2007) [#40]
Good. Mine too. We'll be able to see the same size stuff. I was just messing around and did this. Wanted to show you but wanted to make sure you would see the same thing as me first.


Graphics 320,240,0,1
Color 0,255,0
For a=0 To 240
Plot 160,a
Next
Delay 5000
End



CS_TBL(Posted 2007) [#41]
That'll be a vertical line yes. (no need to run it to see what it does :P)

One thing btw: how high do you think your line is? How many pixels?


Yo! Wazzup?(Posted 2007) [#42]
240 pixels


CS_TBL(Posted 2007) [#43]
why?


Yo! Wazzup?(Posted 2007) [#44]
because it draws 240 dots back-to-back and each dot is 1 pixel wide.


Yo! Wazzup?(Posted 2007) [#45]
actually, no. 1024 pixels on my moniter.


Yo! Wazzup?(Posted 2007) [#46]
If you make it full screen, that is.


CS_TBL(Posted 2007) [#47]
"For 0 to 240" means you'll be doing 241 'things'.

So, your 240 line was actually 241 pixels high.

What you should've typed was:

For a=0 to 239

or

For a=0 to 240-1

The choice is about taste. The -1 is quite common in programming, and the 240 shows you that you intend to have '240' things. The -1 becomes essential when using variables rather than fixed numbers.


Yo! Wazzup?(Posted 2007) [#48]
right. i get it.


CS_TBL(Posted 2007) [#49]
So, to get back on the grid:

A nested For construction is the solution for a grid, and as I showed in that example, you rather want your For values to represent the number of gridpoints rather than the screensize using a Step value.

So, a 14x9 grid with an 8x8 cellsize is done like;
For y=0 To 8
  For x=0 To 13
    Plot x*8,y*8
  Next
Next



Yo! Wazzup?(Posted 2007) [#50]
I love the fact that in programming, (especially Blitz) so little code can produce so large results!



Take this for example:

ClsColor 0,191,255
Cls
While Not KeyDown(1)
AppTitle "Sunshine - Move the mouse around."
Color 255,255,0
Line 0,0,MouseX(),MouseY()
Delay 500
Flip
Wend
End


Or especially this:
While Not KeyDown(1)
Plot MouseX(),MouseY()
Wend
End



CS_TBL(Posted 2007) [#51]
That impressive code:result ratio works for simple small things. You'd be amazed how much code you're actually going to type for just the interface of some tool, just to make all menus work, just to make buttons etc. appear at the right moment. But that's for later..


Yo! Wazzup?(Posted 2007) [#52]
I know, I know.


Yo! Wazzup?(Posted 2007) [#53]
I don't know exactly why, but I keep thinking up really good programming ideas for some reason.


Graphics 800,600,0,2
AppTitle "Crosshair"
While Not KeyDown(1)
Line MouseX(),0,MouseX(),600
Line 0,MouseY(),800,MouseY()
Text 500,25, "Mouse Position: x:" + MouseX() + " y:" + MouseY()
Delay 25
Cls
Wend
End



Siopses(Posted 2007) [#54]
Also like CS_TBL said, follow some of my beggining questions
to build some foundations, also you should learn how to indent properly. But you gotta know what a scope is.
Do you know what a scope is?
{edit}
Also learn what G.U.I is early, its massively complicated to
get the gist of it, but once you do the possibilities are
interminable.


CS_TBL(Posted 2007) [#55]
He doesn't have B+, so he doesn't have the GUI..


Yo! Wazzup?(Posted 2007) [#56]
Also, these have helped me with Blitz and HTML.
here and here. Dynamic Drive is all DHTML if you want to look at it.


Yo! Wazzup?(Posted 2007) [#57]
Anyone here?


CS_TBL(Posted 2007) [#58]
yes, after a Zzz-session (nearly 02:00 in the night here :S)

btw, I should c/p this thread to a book orso and put it on LULU, "Blitz for real beginners" :P


Yo! Wazzup?(Posted 2007) [#59]
---


Siopses(Posted 2007) [#60]
This isn't like a live chat system, Wazzup. You can post
questions and such- but it's not really real time. Also
Wazzup if you don't have Blitz Plus then why are you
in a Blitz Plus forum?


Ked(Posted 2007) [#61]
Ok. Let me just say that you being only 9, you know more than what I did when I started. I started at 12. I am now 15. I didn't know that much about the task manager then. I only knew how to terminate a couple of applications, but thats mostly it.

And now I'm done. Please continue with this... uh... tutorial. :D

EDIT: But something tells me we are still learning about how a forum works. OOOOO!! THAT WAS A FRICKIN' BURN! BUT THE FIRE OUT!

Ok. NOW I'm done. xD

EDIT2: btw I was just joking.


Yo! Wazzup?(Posted 2007) [#62]
Can you give me another program idea?


Siopses(Posted 2007) [#63]
Don't butcher the kid that bad :)...

On a last note remember these things Wazzup

1. Indent using scopes like this:
Graphics 640,320
image=LoadImage("image.bmp")
Repeat
	Draw()
Until KeyDown()=1
Delay 1000
End
Function Draw()
	DrawImage image,MouseX(),MouseY()
End Function 

2. Only use the forums with the general title of
your problem or thread.


CS_TBL(Posted 2007) [#64]
*yawn*

siopses: as long as he sticks to 2d then it doesn't really matter whether he uses the B3d forum or the B+ forum, as long as we know about it (e.g. not to give GUI/event-answers).


TygerWulf(Posted 2007) [#65]
This is a nice program to do that is nifty and makes use of things you're already using, and adds a little bit more. here's a description of it:
Make your window and then plot three points, they can be anywhere, but it works nicely if they make a wide open triangle. Then, plot a third point randomly in the window. Then, keep plotting points by doing the following: Make a random number from 1 to 3. Then, according to the number, plot a point that is halfway between the last point placed and one of the three original points (if the random number is 1 then it will go to the first point you put, 2 it will go to the second, etc.). Plot points until someone pushes a key on the keyboard.

This isn't easy to do if you haven't done it before, but its a nice way to introduce you to some standard programming functions and statements, as well as getting used to math in a programming environment. Besides. I love this program (called The Chaos Game). It was one of the first programs I could make in a boring class period at school in QBasic. It can be tough, though, so feel free to ask questions.


Yo! Wazzup?(Posted 2007) [#66]
I just got onto the computer and have this:
Graphics 800,600,0,2
Global x=Rand(1,800)
Global y=Rand(1,600)
Color 0,255,0
Plot 400,5
Plot 5,595
Plot 795,595
Plot x,y
Delay 5000
End



Yo! Wazzup?(Posted 2007) [#67]
I have a question...
Do the first three pixels plotted (the ones that form a triangle) have to be variables?


Like instead of
Plot 400,5

It would be
Global x=400
Global y=5
Plot x,y



Yo! Wazzup?(Posted 2007) [#68]
Just so you know, I don't know how to indent...
Graphics 800,600,0,2
SeedRnd MilliSecs()
		Global x=Rand(1,800)
		Global y=Rand(1,600)
		Global x1=400
		Global y1andx2=5
		Global y2andy3=595
		Global x3=795
		Global NewDot
		Global NewDot2
		Global whattodo=Rand(1,1)
	While Not KeyDown(1)
Color 0,255,0
			Plot x1,y1andx2
			Plot y1andx2,y2andy3
			Plot x3,y2andy3
			Plot x,y
			Delay 5000
	If whattodo = 1 Then
NewDot=x+x1/2
NewDot2=y+y1andx2/2
Plot NewDot,NewDot2
	EndIf
	Wend
End




It doesn't make another dot between them, it makes a triangle...


I'll work on it.


CS_TBL(Posted 2007) [#69]
ok, crashcourse on indenting:

Commands like For-Next, Repeat-Until, Select-Case-EndSelect etc. define a certain 'area' in which something happens or gets chosen. This area is usually a number of lines in size, sometimes truly a huge area. This area is called a 'scope'.

For readability, one is suggested to indent a scope so that one can easily see where a scope starts and ends. A lot of bugs can be prevented this way.

So, like this:
For b=0 To 7
  For a=0 To 9
    If a=4
      DebugLog a
      If b=3
        DebugLog b
      Endif
    Endif
  Next
Next


Where 'For a' starts is the scope of the 'For b' instruction, where "Debuglog a" starts is the scope of the "If a=4" instruction.

Put a scope-end command (Next, EndIf, Wend, Until, End Function, End Select etc.) straigt under a scope-start command.

So, to see how that works out in my example:

For b=0 To 7
: For a=0 To 9
: . If a=4
: . : DebugLog a
: . : If b=3
: . : . DebugLog b
: . : Endif
: . Endif
: Next
Next


I suggest using the TAB key for indenting, and a TAB size of 4 characters is kind of a universal standard.

In addition to indenting, also make a habit of placing white lines, also for readability (it won't change the functionality of your program, nor does indenting do so).

For b=0 To 7
  For a=0 To 9

    If a=4
      DebugLog a

      If b=3
        DebugLog b
      Endif

    Endif

  Next
Next


Where and how you add a whiteline is open for debate, try to see certain commands as part of a group. You want to divide groups with whitelines.


TygerWulf(Posted 2007) [#70]
You seem to be on the right track here. I'm so tired that I'm not able to read the math straight right now. The biggest thing I see is that your using Rand(1, 1) which can only return 1, so you aren't doing anything with the other sets of points. You haven't tested for the other numbers yet, so I figure you're going to do it next. My suggestion will be to reduce your delay. Don't take it out, you'll ruin the suspense, but put it at 20 or so. Also, instead of saying While Not KeyDown(1), you can use While Not GetKey() to test if any button on the keyboard is pressed. Anyway. You're doing well. I'm going to bed though.


Yo! Wazzup?(Posted 2007) [#71]
This is a heavily commented but not indented program.
I just made it.




CS_TBL(Posted 2007) [#72]
And all those comments make it unreadable.

A command like "Graphics 640,480" .. do you really need comments for that? Do you need a comment for 'End'? Do you need a comment to say you're starting a function?

Don't overdo, a lot of instructions are self-explanatory. Commenting is mainly done for a group of instructions that *together* do one thing which is not easily to comprehend by just looking at it, especially not after 8 months of not looking at it.


Yo! Wazzup?(Posted 2007) [#73]
Did you look at what it does? Just because it's commented doesn't mean you can't run it!


CS_TBL(Posted 2007) [#74]
Keep in mind that an IDE in which you type your code almost acts as a painting canvas. You have to see at a distance where to look, and actually *can* see at a distance where to look, even without reading. All this indenting, whitelining and minor commenting is actually a langauge on its own, serving your unconsciousness. If the 'painting' lacks form because all the comment-text steals the form away then it's quite crap to navigate in a visual way.


CS_TBL(Posted 2007) [#75]
I see what it does from just reading it. Some things can be improved a lot.


Yo! Wazzup?(Posted 2007) [#76]
I thought you said it was unreadable!


Yo! Wazzup?(Posted 2007) [#77]



CS_TBL(Posted 2007) [#78]
consider this:

Newnum=FindMidNum()
;Prints the Middle Number
Print newnum

If you aren't going to use Newnum anymore, other than printing, you can also do:

Print FindMidNum()

Key-rule for programming: less=more


CS_TBL(Posted 2007) [#79]
It is unreadable.. uhm.. ofcourse anything can be read, but ppl use that expression when they have a hard time reading something which is messy. People are lazy. Tho in this case the lazyness is of a good type. :P


Yo! Wazzup?(Posted 2007) [#80]
I like this program that came with Blitz-look up oval in the command reference.

; Oval example
Graphics 800,600,16

; Wait for ESC to hit
While Not KeyHit(1)
; Set a random color
Color Rnd(255),Rnd(255),Rnd(255)
; Draw a random oval
Oval Rnd(800),Rnd(600),Rnd(100),Rnd(100),Rnd(0,1)
Wend



CS_TBL(Posted 2007) [#81]
Not all example programs in the manual are that good or consistent in style. Besides a manual is only meant to briefly describe command and structures, it doesn't really explain you how to 'code', as that's all based on experience.

Take a look in the code archives of this forum and observe how ppl comment/indent/whiteline their things.


Yo! Wazzup?(Posted 2007) [#82]
Graphics 800,600,0,1
AppTitle "Crosshair"
While Not KeyDown(1)
Color 255,255,255
Text 1,1, "Hold down the two mouse buttons and space and move the mouse around."
While MouseDown(1) And MouseDown(2) And KeyDown(57)
Cls
Color 255,0,0
Line MouseX(),0,MouseX(),600
Color 0,0,255
Line 0,MouseY(),800,MouseY()
Color 0,255,0
Text 500,25, "Mouse Position: x:" + MouseX() + " y:" + MouseY()
Delay 25
Cls
Wend
Wend
End



CS_TBL(Posted 2007) [#83]
Now take exactly this program, and start indenting and whitelining it.


Yo! Wazzup?(Posted 2007) [#84]
Global w
Global x=255
Global y
	While Not KeyDown(1)
		While MouseDown(1)
			Color w,y,x
					
					If KeyHit(2) Then
						x=255
						w=0
						y=0
					EndIf
						If KeyHit(3) Then
							x=0
							w=255
							y=0
						EndIf
							If KeyHit(4) Then
								x=0
								w=0
								y=255
							EndIf
								If KeyHit(5) Then
									x=255
									w=255
									y=255
								EndIf
									If KeyHit(6) Then
										x=255
										w=255
										y=0
									EndIf								
										If KeyHit(7) Then
											x=255
											w=0
											y=255
										EndIf	
											If KeyHit(8) Then
												x=0
												w=255
												y=255
											EndIf
			Oval MouseX(),MouseY(),10,10,1
		Wend
		If KeyHit(14) Then
			Cls
		EndIf
	Wend
End





What other colors should I add?


CS_TBL(Posted 2007) [#85]
dude, that looks terrible, I do you dare to claim it looks clean, logical and readable? :P


Yo! Wazzup?(Posted 2007) [#86]
I know it looks terrible. Tell me what other colors I should do. I thought you said to make small, dumb programs.
And If you can make a cleaner one, show me.


Yo! Wazzup?(Posted 2007) [#87]
I edited it just now. Is that better?


CS_TBL(Posted 2007) [#88]
no.

Why are those If's all going to the right?


Blitz123(Posted 2007) [#89]
This is one of the longest forum post I have ever seen. As a matter of fact, I'm also a teenager. :-)
Indentings one of those things you gotta get into a habit of doing it without thinking about it. Also, if you have Protean IDE(I do) you can click on a little box and minimise functions to one line and things like that so they dont take up any room.Helps keep things clean.


Yo! Wazzup?(Posted 2007) [#90]
Why are those If's all going to the right?

I don't know... I can't indent.


Blitz123(Posted 2007) [#91]
Basicly, every time you start a new scope(loop,If,Select,Function ect.) You go in a space(looks way better than an entire tab)
Every time you close a scope, you go back in a space.
e.g.
Graphics 800,600
SetBuffer BackBuffer()

For i=1 to 10
.Print "Pointless Loop 1 to 10"
..If userboard= True Then
..Print "You are board"
..Print "Now Quitting.."
..Exit
.EndIf
Next


CS_TBL(Posted 2007) [#92]
This is enough indenting and whitelining:
Global w
Global x=255
Global y

While Not KeyDown(1)
	While MouseDown(1)
		Color w,y,x
					
		If KeyHit(2) Then
			x=255
			w=0
			y=0
		EndIf
		If KeyHit(3) Then
			x=0
			w=255
			y=0
		EndIf
		If KeyHit(4) Then
			x=0
			w=0
			y=255
		EndIf
		If KeyHit(5) Then
			x=255
			w=255
			y=255
		EndIf
		If KeyHit(6) Then
			x=255
			w=255
			y=0
		EndIf								
		If KeyHit(7) Then
			x=255
			w=0
			y=255
		EndIf	
		If KeyHit(8) Then
			x=0
			w=255
			y=255
		EndIf
		
		Oval MouseX(),MouseY(),10,10,1
		
	Wend
	
	If KeyHit(14) Then
		Cls
	EndIf
	
Wend
End


See, those If's only need indenting between the If and the EndIf, but as a whole (If..EndIf) it's just like one (big) command, and commands can just be put under eachother.


Blitz123(Posted 2007) [#93]
Why does everyone go in entire tabs? I find spaces look much neater.


CS_TBL(Posted 2007) [#94]
For me: a tab of 4 characters reads more comfy, and tab is an easy way to move a whole block to the right or to the left (with +shift). Moving whole blocks happens all the time. Besides using tab to indent is kinda standard anyway,


Blitz123(Posted 2007) [#95]
Is it? I've never seen it used in the archives. Another thing, how do you get the images in you signiture?


CS_TBL(Posted 2007) [#96]
Another thing to learn is to make standard names for your variables. If you use standard names then in the long run it's much easier to recognize what you're doing.

For colors, it's usually convenient to use r, g and b as variables. For coordinates x and y are typically used. When doing 3d coordinates: x, y and z are used.
For generic counters (e.g. a Forloop not related to x,y) names like t, i and j are used.
There are some more personal favorites, like s$ for a string, c for a color (as int), tmp or temp for temporarily variables.


CS_TBL(Posted 2007) [#97]
signature: just put a link to an image in your signature field.. that's all.

But don't overdo! large signature pix are annoying. Rather have it more wider than higher (but not wider than a typical screen res), if you must present a lot of pixels.
Also, keep the format small. Everyone is waiting on 'em to load.


Blitz123(Posted 2007) [#98]
Oh, i see, it needs to be hosted: I thought it might be somthing like that.I shall have to wait till I get my website then...


CS_TBL(Posted 2007) [#99]
You can also just abuse some random picture somewhere on the net, like this one :P

http://tbn0.google.com/images?q=tbn:0xlW85dNQDdRkM:http://web.syr.edu/~rtharper/w00t%2520sheep.jpg

http://tbn0.google.com/images?q=tbn:0xlW85dNQDdRkM:http://web.syr.edu/~rtharper/w00t%2520sheep.jpg


CS_TBL(Posted 2007) [#100]
post nr. 100 in less than 2 days, for xxx sake!


Blitz123(Posted 2007) [#101]
Like I said, biggest topic I've ever seen...

Yo!Wazzup? seems to have wandered off for now.


Yo! Wazzup?(Posted 2007) [#102]
Yeah... I was in Code Archives land for about an hour...



Like I said, biggest topic I've ever seen...


right.... 102 posts!


Ked(Posted 2007) [#103]
The "WinBlitz3D" topic was bigger I think. But no one posts there anymore.


Blitz123(Posted 2007) [#104]
I think we hold the record...
-----------------------------
~ ChatterBox ~
~ Biggist Forum Topic 2007 ~
~ 104 Posts ~
-----------------------------
No medal.


Blitz123(Posted 2007) [#105]
The apple DIES NOW!
Nice pic! Yo!Wazzup?


Yo! Wazzup?(Posted 2007) [#106]
There. I got you a medal. And, I think we desere some money, too.



Yo! Wazzup?(Posted 2007) [#107]
Not only is this a long topic, It only took a day!


Yo! Wazzup?(Posted 2007) [#108]



Hey! The old man is takin' away all the money! AAAAAAA!!! He's Hitting me with his raggedy cane!


CS_TBL(Posted 2007) [#109]
ok boys, back to class, no toying. :P And Wazzup: that pic is actually a bit too high already.


Yo! Wazzup?(Posted 2007) [#110]
Alright, I got to go. Bye!


Yo! Wazzup?(Posted 2007) [#111]
actually, no, I don't have to go.


CS_TBL(Posted 2007) [#112]
wazzup, do me a favor and use this one:
http://tbn0.google.com/images?q=tbn:31vwXFd6ZRQeaM:http://forums.vr-zone.com/f/gif/wazzup.gif



Yo! Wazzup?(Posted 2007) [#113]
Now take exactly this program, and start indenting and whitelining it.


Like this?
Graphics 800,600,0,1
AppTitle "Crosshair"
While Not KeyDown(1)
	
	Color 255,255,255
	Text 1,1, "Hold down the two mouse buttons and space and move the mouse around."
	While MouseDown(1) And MouseDown(2) And KeyDown(57)
		
		Cls
		Color 255,0,0
		Line MouseX(),0,MouseX(),600
		
		Color 0,0,255
		Line 0,MouseY(),800,MouseY()
		
		Color 0,255,0
		Text 500,25, "Mouse Position: x:" + MouseX() + " y:" + MouseY()
		
		Delay 25
		Cls
		
	Wend
	
Wend
End



CS_TBL(Posted 2007) [#114]
yes, now add whitelines!


Yo! Wazzup?(Posted 2007) [#115]
That good?


CS_TBL(Posted 2007) [#116]
yep! For your new sources, continue exactly like this!


CS_TBL(Posted 2007) [#117]
apart from a detail:

These:

Color 0,255,0
Text 500,25, "Mouse Position: x:" + MouseX() + " y:" + MouseY()

belong together, so they should be grouped, meaning a whiteline between that color statement and the previous line function.


Yo! Wazzup?(Posted 2007) [#118]
Uhhhh... I cheated for the indenting. But now, I won't need to learn to indent!


I'ts the newest thing in the toolbox!
IDEal-It automatically indents code.


CS_TBL(Posted 2007) [#119]
so do you understand what you've indented and why?


Yo! Wazzup?(Posted 2007) [#120]
sorta...


Yo! Wazzup?(Posted 2007) [#121]
I mean... like... While and wend have to be indented the same way...
And loops do, too.
That's pretty much all I know about indenting.


CS_TBL(Posted 2007) [#122]
in your current version:

Color 0,255,0
Text 500,25, "Mouse Position: x:" + MouseX() + " y:" + MouseY()

are too much to the right. Put them straight under the above commands.


Yo! Wazzup?(Posted 2007) [#123]
oops... It got a little messed up and was hard to fix...


CS_TBL(Posted 2007) [#124]
that looks like using spaces. Did you use the [tab]-key?


Yo! Wazzup?(Posted 2007) [#125]
uhhh... When I used the tab key, it went up into the url thing and i was sure I had the cursor in the textbox.


Yo! Wazzup?(Posted 2007) [#126]
Also, look back at the top post or this post when you want to go to the bottom of the page. This topic is so long I found out each post had an a name and now you can go to the bottom of the topic instantly.

type #765906 after everything in the url to go to the bottom of the page.


CS_TBL(Posted 2007) [#127]
Ah rite, classic problem here. You must type code in Blitz itself, and copy/paste it into this place, or you'll be spacing forever. Having hard-types spaces is very inconvenient.


Yo! Wazzup?(Posted 2007) [#128]
I'm you!


Yo! Wazzup?(Posted 2007) [#129]
I love the fact that you can change your Nick Name!


CS_TBL(Posted 2007) [#130]
please don't. or you can go searching for another teacher :/


Yo! Wazzup?(Posted 2007) [#131]
Are you still here?


Yo! Wazzup?(Posted 2007) [#132]
ok


CS_TBL(Posted 2007) [#133]
You might be a 9yo kid and thus 'be a kid', but understand that most ppl here are quite a bit older. This is a forum for a payed product, so at least pretend to be older.


Yo! Wazzup?(Posted 2007) [#134]
Ok. I have been trying, it's just so hard.


Yo! Wazzup?(Posted 2007) [#135]
but did you look at this?

Also, look back at the top post or this post when you want to go to the bottom of the page. This topic is so long I found out each post had an a name and now you can go to the bottom of the topic instantly.

type #765906 after everything in the url to go to the bottom of the page.





Yo! Wazzup?(Posted 2007) [#136]
the number 765906 changes after each post has been made, so I keep editing posts.


CS_TBL(Posted 2007) [#137]
Usually when threads grow too large they're locked and a new thread is started. At this rate, about tomorrow it'll be a good point to start a new thread. But try to be less chatty and more Blitz-productive, it's no MSN here eh.


Yo! Wazzup?(Posted 2007) [#138]
heh heh...


Yo! Wazzup?(Posted 2007) [#139]
I have to go.


Yo! Wazzup?(Posted 2007) [#140]
I'm back.


Yo! Wazzup?(Posted 2007) [#141]
U got any more ideas for programs?


b32(Posted 2007) [#142]
Have you looked at the b3d forum version of this topic ? I posted an example of using Joinnetgame there.


Yo! Wazzup?(Posted 2007) [#143]
I know, I looked... I don't know how to do the two on 1 pc thing


b32(Posted 2007) [#144]
:) Press F5 twice


Yo! Wazzup?(Posted 2007) [#145]
no, i mean when it pops up the start internet game dialog.


b32(Posted 2007) [#146]
Choose: connection=TCP/IP
Then another box appears, enter nothing, press Ok
The program returns to the first dialog, enter a name for the game and press "Create New Game"
After the game runs, return to Blitz, press F5 again and
choose again TCP/IP
Again, the other box appears. Press Ok again, this time it should find the game you started. To join it, click on it's name.
For making a chat application, just use the CreateNetGame, CreateNetPlayer and SendNetMsg commands.


TygerWulf(Posted 2007) [#147]
Because I know some people on many forums who get annoyed by things like this, I'm going to give you a pointer or two about forum etiquette. This, and most of the forums on the Blitz site are professional forums (meaning that, for the most part, they're forums that have a specific purpose that have serious discussions in them). In a professional forum it is looked down upon when you make a post that says "I have to go." or "I'm back."The nature of forums is that people can post something, leave and then come back later so that they can read the responses. CS_TBL has been nice enough to spend a great amount of time talking back and forth with you (and should be commended, this thing's spanned more than 12 hours now). It's important to say that he probably isn't just sitting there refreshing the page waiting for a reply. After you post something that's part of the discussion, sit back, wait, play around with things in blitz. Do a tutorial in the tutorials forum, read some of the manual, and be patient while someone makes a reply. If you've got something important to say you can A: edit your last post if it directly relates to that post (and you're the last poster) or write a new post, just make sure what you add is part of the serious discussion. This will probably keep people from yelling at you. =^_^=

To make a long post longer, remember that program I talked about last night? Well, I'm horrible at describing what the result should be. So I decided to drop in the code that I made for it. you can see where your code differs from mine and see what i was trying to get you to do. Really, it was a lot simpler than I thought it was. I think I once tried to do it with the distance formula. that was horrendous:

Graphics 640, 480, 0, 2
x1= 320
y1 = 10
x2 = 10
y2 = 470
x3 = 630
y3 = 470
pointx = Rnd(640)
pointy = Rnd(480)

Plot x1, y1
Plot x2, y2
Plot x3, y3


While Not GetKey()

	rnum = Rand(3)
	
	If rnum = 1 Then
		pointx = ((pointx + x1)/2)
		pointy = ((pointy + y1)/2)
	ElseIf rnum = 2 Then
		pointx = ((pointx + x2)/2)
		pointy = ((pointy + y2)/2)
	ElseIf rnum = 3 Then
		pointx = ((pointx + x3)/2)
		pointy = ((pointy + y3)/2)
	EndIf
	
	Color 255,255,255
	Plot pointx,pointy
	Delay 20

Wend

End


I know I'm not the best coder (and I'm horrid at commenting) but it works like I want it to.


CS_TBL(Posted 2007) [#148]
I can somewhat understand the nature of wazzup's writing tho. When I was 9, what was I doing? 3rd-year piano lessons, another kilogram of Lego (^_^), biking a bit after school with some dudes, and prolly be a bit annoying here and there, tho I was prolly quite decent I think ^_^
Tho when keeping the average age and style of this forum in mind, and the fact that we've payed to be here, it's up to wazzup to snatch a Delorean and come out as someone older.. or uh.. something like that (that wouldn't work, would it? :D).
That on its own is almost ridiculous however. Could you be bothered, as a 9yo, to act like a 16yo++ all of a sudden?

The issue is that a handful o' ppl know who wazzup is, and in a month, most have forgotten it. Whenever he goes to the General Forum and mix up with the rest of the discussions.. well, brace yourself: if there's one thing worse than a Mac-PC feud, then it's a Mac-PC feud with a 9yo of which we've forgotton he's a 9yo, orso.. :P

Best way to act for wazzup is to carefully read the whole forum and do as the others do. Not easy perhaps, but you don't want a horde of mature ppl getting pissed.

-and now I shall sleep .. it's past 03:00 here o_o -


Yo! Wazzup?(Posted 2007) [#149]
But you have to know, PCs are better :/


daaan(Posted 2007) [#150]
HAHAHAHAHHAHAHAHAHAHAHAHAHAH! Is this a joke or what? A sick belated and brilliant April fools joke perhaps? Either there is one hilarious individual toying with us or a nine year old who has a problem with indenting that needs all the help he/she can get.

Also, just to clarify the whole annoying computer feud, macs and pcs are nothing when compared to the all mighty digital wrist watch/calculator combo. Put that in your pipe and smoke it.