Qbasicnews.com
December 16, 2019, 06:40:45 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 ... 8 9 [10] 11
  Print  
Author Topic: Structured Programming  (Read 31795 times)
stylin
Ancient QBer
****
Posts: 445


« Reply #135 on: December 19, 2005, 02:05:44 AM »

Quote from: "axipher"
So it's more of a way of accessing a mathematical equation?

It's a way of accessing any information from a routine. For example, in a string concatenation routine, you can return the result of the concatenation. In an open file routine, you can return the file handle of the open file. Whatever information is pertinent to the result of the function being executed you can return. In other words, you use functions (as opposed to subs) when you need some kind of information from the routine after it is finished executing.
Logged

stylin:
Z!re
*/-\*
*****
Posts: 4599


« Reply #136 on: December 19, 2005, 02:07:23 AM »

Quote from: "axipher"
So it's more of a way of accessing a mathematical equation?
Subds and functions are groups of code that you can reuse over and over without typing the entire code over and over:
Code:
declare function myFunction( a, b, c)
screen 12
print myFunction(1, 5, 7)
print myFunction(1, 5, 8)
print myFunction(1, 5, 9)
sleep

function myFunction(a, b, c)
  line ( a, b )-( a, c ), 15
  circle (a, b), c, 15
  return a+b+c
end function
Logged
axipher
Ancient Guru
****
Posts: 544



« Reply #137 on: December 19, 2005, 02:22:35 AM »

Oh, ok, but I don't think I'd be using them very often, I'd prefer to cop and paste what I need over again so I don't have to look all over file for it, normaly I don't code with all the SUB's, GOSUB's, and DATA at the bottom, I enter it when I need it and it gets messy fast, atleast if I copy and paste the code, then I can just use FB's replace feature to change it all.
Logged
thegrogen
Ancient QBer
****
Posts: 444



« Reply #138 on: December 19, 2005, 02:23:25 AM »

Quote from: "axipher"
Oh, ok, but I don't think I'd be using them very often, I'd prefer to cop and paste what I need over again so I don't have to look all over file for it, normaly I don't code with all the SUB's, GOSUB's, and DATA at the bottom, I enter it when I need it and it gets messy fast, atleast if I copy and paste the code, then I can just use FB's replace feature to change it all.


I've got a bad feeling about this...
Logged

.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #139 on: December 19, 2005, 02:42:13 AM »

Blame FBIde not separating stuff..
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
marzecTM
Ancient Guru
****
Posts: 688


« Reply #140 on: December 19, 2005, 03:03:49 AM »

am i the only one who thinks this guy is fake?

ooh and aga elaborate on the "blame fbide" statement please.
Logged

quote="NecrosIhsan"]

[/quote]
yetifoot
Ancient Guru
****
Posts: 575



« Reply #141 on: December 19, 2005, 10:52:02 AM »

Quote
am i the only one who thinks this guy is fake?


im a bit unsure.  the other day im sure he posted something that looked a bit too literate, which made me think he's just pulling our chains.
Logged

EVEN MEN OF STEEL RUST.
axipher
Ancient Guru
****
Posts: 544



« Reply #142 on: December 19, 2005, 12:58:46 PM »

What did I post that was too literate???  My paint program is probably my first program to have some structure, I'm sure I can dig up some examples of programs that didn't even use GOSUB's let alone GOTO's, SUB's, and FUNCTION's.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #143 on: December 19, 2005, 05:10:37 PM »

FBIde doesn't separate SUBs and functions yet, as far as I know.

BTW:
To make a program work in the Starcraft trigger editor (OR ANY OTHER TRIGGER EDITOR!), AFAIK, you need to make a HUGE SPAGHETTI CODE PROGRAM! That's where axipher started his adventures it appears.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Z!re
*/-\*
*****
Posts: 4599


« Reply #144 on: December 19, 2005, 05:15:24 PM »

Quote from: "Agamemnus"
FBIde doesn't separate SUBs and functions yet, as far as I know.

BTW:
To make a program work in the Starcraft trigger editor (OR ANY OTHER TRIGGER EDITOR!), AFAIK, you need to make a HUGE SPAGHETTI CODE PROGRAM! That's where axipher started his adventures it appears.
What? Starcraft editor is event based.. Thats the whole point of using triggers..
Logged
axipher
Ancient Guru
****
Posts: 544



« Reply #145 on: December 19, 2005, 10:44:34 PM »

Quote from: "Z!re"
Quote from: "Agamemnus"
FBIde doesn't separate SUBs and functions yet, as far as I know.

BTW:
To make a program work in the Starcraft trigger editor (OR ANY OTHER TRIGGER EDITOR!), AFAIK, you need to make a HUGE SPAGHETTI CODE PROGRAM! That's where axipher started his adventures it appears.
What? Starcraft editor is event based.. Thats the whole point of using triggers..


You are misguided young StarCraft adventurer, yes StarCraft tirggers are event based, in other words, for certain players, when all of the conditions are met, the actions take place, you can also add a preserve trigger to make iot a loop while the conditions are being met, so it's like IF...THEN and WHILE...WEND loops.  Now what I mean by misguided is that there are text-based trigger editors and there was one trigger editor I saw that actually allowed you to program in other languages and it compiled the code into triggers, very advanced triggers.  Now I never thought about it Aga, but maybe my programming techniques also derived from my years of day-by-day map making and having triggers that can be created in any order and still work the same.  So I guess in a way, my programming techniques are pretty much structured by StarCraft's standards.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #146 on: December 20, 2005, 07:21:28 PM »

No, no, no....

To write a proper Starcraft scenario system that is linearly based, you must use the equivalent of GOTOs. One trigger activates another which activates another, etc. I'm not talking about making junky little scenarios with junky little independent events... I'm talking about Monopoly!

For my Starcraft Monopoly game, what would consist of a few loops and some instructions in QB/FB code is a pile of GOTOs jumping from one trigger to another...
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
axipher
Ancient Guru
****
Posts: 544



« Reply #147 on: December 20, 2005, 11:29:58 PM »

Quote from: "Agamemnus"
No, no, no....

To write a proper Starcraft scenario system that is linearly based, you must use the equivalent of GOTOs. One trigger activates another which activates another, etc. I'm not talking about making junky little scenarios with junky little independent events... I'm talking about Monopoly!

For my Starcraft Monopoly game, what would consist of a few loops and some instructions in QB/FB code is a pile of GOTOs jumping from one trigger to another...


GOTO's in StarCraft would be switches, are combination of switches for larger numbers through binary, I use about 8 switches for the binary number, then certain events happen when the binary number is it's corresponding number, it's a technique not used by many, but very cheap and effective.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #148 on: December 21, 2005, 03:08:47 AM »

Yes, it is, but it's more programming. (Good thinking! I use that in Monopoly as well, but for random numbers only, so far.)

A FB-SC converter would be nice. *starts dreaming*
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
axipher
Ancient Guru
****
Posts: 544



« Reply #149 on: December 21, 2005, 12:10:49 PM »

Man, that would be sweet, that or making a fb version of Starcraft and the triggers can be made using a trigger editor or by text, man, sweeeeeet.  *Starts day-dreaming also*
Logged
Pages: 1 ... 8 9 [10] 11
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!