The QBasic Forum      Other Subforums, Links and Downloads
 
  << Previous Topic | Next Topic >>Return to Index  

Scrolling 'help' menu for Mike. (Reagan speech provided as test data.)

February 1 2009 at 11:25 PM
  (Login The-Universe)
Admin

DEFINT I
DECLARE SUB convert ()
DECLARE SUB help (b$)
DECLARE SUB getkey (b$)
DIM SHARED textline AS STRING * 80
DIM SHARED iwindowtop, iwindowbottom, iwindowright, iwindowleft
DIM SHARED itextscreentop, itextscreenbottom, itextscreenleft, itextscreenright
DIM SHARED hp%, ismode, iscroll, iscrollmax, irow, icol

iwindowtop = 1
iwindowbottom = 25
iwindowright = 80
iwindowleft = 1
itextscreentop = iwindowtop + 2
itextscreenbottom = iwindowbottom - 2
itextscreenleft = iwindowleft + 1
itextscreenright = iwindowright - 1
iscroll = 1
ismode = 0
hp% = 1

CLS : CALL convert

SCREEN 0, 0, ismode, ismode
PRINT "Press the tilde key [~] for help...";
CALL getkey(b$)
SYSTEM

SUB convert
DIM x AS STRING * 80
OPEN "reagan.txt" FOR INPUT AS #1
OPEN "reagan.dat" FOR OUTPUT AS #2: CLOSE #2
OPEN "reagan.dat" FOR RANDOM AS #2 LEN = 80
DO
IF LEN(a$) < 200 AND NOT EOF(1) THEN LINE INPUT #1, a1$
IF a1$ = "EOF" THEN a1$ = a1$ + SPACE$(80 - 3)
IF RTRIM$(a1$) = "" THEN IF EOF(1) THEN EXIT DO ELSE a1$ = SPACE$(80): REM Line
a$ = a$ + a1$: a1$ = ""
x1$ = MID$(a$, 1, 78 + 1)
IF MID$(x1$, 78 + 1, 1) = " " THEN
a$ = LTRIM$(MID$(a$, 78 + 1))
IF MID$(x1$, 1, 3) = "EOF" THEN x = RTRIM$(x1$) ELSE x = " " + RTRIM$(x1$)
ELSE
FOR i = LEN(x1$) TO 1 STEP -1
IF MID$(x1$, i, 1) = " " OR i = 1 THEN EXIT FOR
NEXT
a$ = LTRIM$(MID$(a$, i))
x = " " + MID$(x1$, 1, i - 1)
END IF
REM PRINT x
i2 = i2 + 1
PUT #2, i2, x
LOOP
CLOSE #1, #2
END SUB

SUB getkey (b$)
DO
DO
b$ = INKEY$
IF b$ = "`" OR b$ = "~" THEN
IF hp% <> 9999 THEN holdhp% = hp%: hp% = 9999: ELSE hp% = holdhp%
END IF
LOOP UNTIL LEN(b$)
SELECT CASE hp%
CASE 1
IF b$ = CHR$(27) THEN SYSTEM
IF b$ = "~" OR b$ = "`" THEN CALL help(b$)
CASE 9999
SELECT CASE b$
CASE CHR$(0) + "H"
IF iscroll > 1 THEN iscroll = iscroll - 1
CASE CHR$(0) + "P"
IF iscroll < iscrollmax - (itextscreenbottom - itextscreentop) THEN iscroll = iscroll + 1
CASE CHR$(0) + "I"
IF iscroll > 1 THEN
iscroll = iscroll - (itextscreenbottom - itextscreentop): IF iscroll < 1 THEN iscroll = 1
ELSE
b$ = ""
END IF
CASE CHR$(0) + "Q"
IF iscroll < iscrollmax THEN
IF iscroll < iscrollmax - ((itextscreenbottom - itextscreentop) * 2) - 1 THEN
iscroll = iscroll + (itextscreenbottom - itextscreentop)
ELSE
iscroll = iscrollmax - (itextscreenbottom - itextscreentop)
END IF
ELSE
b$ = ""
END IF
CASE CHR$(0) + "w"
iscroll = 1
CASE CHR$(0) + "u"
iscroll = iscrollmax - (itextscreenbottom - itextscreentop)
END SELECT
IF b$ <> "" THEN CALL help(b$)
END SELECT
LOOP
END SUB

SUB help (b$)
STATIC iFlaghp, holdsmode%
DIM helptext AS STRING * 80

IF b$ = "`" AND iFlaghp = 1 OR b$ = "~" AND iFlaghp = 1 THEN
REM Exit Help
iFlaghp = 0: ismode = holdsmode%: SCREEN 0, 0, ismode, ismode
LOCATE irow, icol
iscroll = 1
EXIT SUB
END IF

IF iFlaghp = 0 THEN
holdsmode% = ismode: ismode = 2
irow = CSRLIN: icol = POS(0)
iscroll = 1
SCREEN 0, 0, ismode, ismode
LOCATE , , 0
COLOR 11, 1: VIEW PRINT: CLS 2
REM skin
title$ = "Help Menu Demo"
LOCATE 1, 41 - LEN(title$) \ 2: PRINT title$;
COLOR 14, 1
LOCATE 2, 1: PRINT STRING$(80, 196);
LOCATE 24, 1: PRINT STRING$(80, 196);
COLOR 11, 1
prompt$ = "[" + CHR$(24) + "]/[" + CHR$(25) + "] [Page Up] [Page Down] [Ctrl+Home] [Ctrl+End] [~] Exit Help"
LOCATE 25, 41 - LEN(prompt$) \ 2: PRINT prompt$;

REM Open File
i = 0
ifile = FREEFILE
OPEN "reagan.dat" FOR RANDOM AS #ifile LEN = 80
DO UNTIL EOF(ifile)
i = i + 1
GET #1, i, helptext
IF MID$(helptext, 1, 3) = "EOF" THEN EXIT DO
LOOP
iFlaghp = 1: iscrollmax = i - 1
END IF

REM Get/Print Text
PCOPY ismode, 7: SCREEN 0, 0, 7, ismode
LOCATE itextscreentop
COLOR 7, 1
GET #1, (iscroll - 1) + itextscreenbottom - itextscreentop, helptext
FOR i = iscroll TO iscroll + itextscreenbottom - itextscreentop
GET #1, i, helptext
LOCATE , itextscreenleft - 1
PRINT helptext
NEXT
PCOPY 7, ismode
SCREEN 0, 0, ismode, ismode

END SUB



--------------------------------------------

Copy and paste below in a file called "reagan.txt" in your QB directory.



Reagan: Thank you. Thank you very much. Thank you and good evening. The sponsor has been identified, but unlike most television programs, the performer hasn't been provided with a script. As a matter of fact, I have been permitted to choose my own words and discuss my own ideas regarding the choice that we face in the next few weeks.

I have spent most of my life as a Democrat. I recently have seen fit to follow another course. I believe that the issues confronting us cross party lines. Now, one side in this campaign has been telling us that the issues of this election are the maintenance of peace and prosperity. The line has been used, "We've never had it so good."

But I have an uncomfortable feeling that this prosperity isn't something on which we can base our hopes for the future. No nation in history has ever survived a tax burden that reached a third of its national income. Today, 37 cents out of every dollar earned in this country is the tax collector's share, and yet our government continues to spend 17 million dollars a day more than the government takes in. We haven't balanced our budget 28 out of the last 34 years. We've raised our debt limit three times in the last twelve months, and now our national debt is one and a half times bigger than all the combined debts of all the nations of the world. We have 15 billion dollars in gold in our treasury; we don't own an ounce. Foreign dollar claims are 27.3 billion dollars. And we've just had announced that the dollar of 1939 will now purchase 45 cents in its total value.

As for the peace that we would preserve, I wonder who among us would like to approach the wife or mother whose husband or son has died in South Vietnam and ask them if they think this is a peace that should be maintained indefinitely. Do they mean peace, or do they mean we just want to be left in peace? There can be no real peace while one American is dying some place in the world for the rest of us. We're at war with the most dangerous enemy that has ever faced mankind in his long climb from the swamp to the stars, and it's been said if we lose that war, and in so doing lose this way of freedom of ours, history will record with the greatest astonishment that those who had the most to lose did the least to prevent its happening. Well I think it's time we ask ourselves if we still know the freedoms that were intended for us by the Founding Fathers.

Not too long ago, two friends of mine were talking to a Cuban refugee, a businessman who had escaped from Castro, and in the midst of his story one of my friends turned to the other and said, "We don't know how lucky we are." And the Cuban stopped and said, "How lucky you are? I had someplace to escape to." And in that sentence he told us the entire story. If we lose freedom here, there's no place to escape to. This is the last stand on earth.

And this idea that government is beholden to the people, that it has no other source of power except the sovereign people, is still the newest and the most unique idea in all the long history of man's relation to man.

This is the issue of this election: whether we believe in our capacity for self-government or whether we abandon the American revolution and confess that a little intellectual elite in a far-distant capitol can plan our lives for us better than we can plan them ourselves.

You and I are told increasingly we have to choose between a left or right. Well I'd like to suggest there is no such thing as a left or right. There's only an up or down: [up] man's old -- old-aged dream, the ultimate in individual freedom consistent with law and order, or down to the ant heap of totalitarianism. And regardless of their sincerity, their humanitarian motives, those who would trade our freedom for security have embarked on this downward course.

In this vote-harvesting time, they use terms like the "Great Society," or as we were told a few days ago by the President, we must accept a greater government activity in the affairs of the people. But they've been a little more explicit in the past and among themselves; and all of the things I now will quote have appeared in print. These are not Republican accusations. For example, they have voices that say, "The cold war will end through our acceptance of a not undemocratic socialism." Another voice says, "The profit motive has become outmoded. It must be replaced by the incentives of the welfare state." Or, "Our traditional system of individual freedom is incapable of solving the complex problems of the 20th century." Senator Fulbright has said at Stanford University that the Constitution is outmoded. He referred to the President as "our moral teacher and our leader," and he says he is "hobbled in his task by the restrictions of power imposed on him by this antiquated document." He must "be freed," so that he "can do for us" what he knows "is best." And Senator Clark of Pennsylvania, another articulate spokesman, defines liberalism as "meeting the material needs of the masses through the full power of centralized government."

Well, I, for one, resent it when a representative of the people refers to you and me, the free men and women of this country, as "the masses." This is a term we haven't applied to ourselves in America. But beyond that, "the full power of centralized government" -- this was the very thing the Founding Fathers sought to minimize. They knew that governments don't control things. A government can't control the economy without controlling people. And they know when a government sets out to do that, it must use force and coercion to achieve its purpose. They also knew, those Founding Fathers, that outside of its legitimate functions, government does nothing as well or as economically as the private sector of the economy.

Now, we have no better example of this than government's involvement in the farm economy over the last 30 years. Since 1955, the cost of this program has nearly doubled. One-fourth of farming in America is responsible for 85% of the farm surplus. Three-fourths of farming is out on the free market and has known a 21% increase in the per capita consumption of all its produce. You see, that one-fourth of farming -- that's regulated and controlled by the federal government. In the last three years we've spent 43 dollars in the feed grain program for every dollar bushel of corn we don't grow.
EOF


    
This message has been edited by The-Universe on Sep 9, 2009 3:48 PM
This message has been edited by The-Universe on Feb 1, 2009 11:59 PM


 
 Respond to this message   
AuthorReply

(Login wargame4mike)
R

thanks pete but...

February 4 2009, 1:55 PM 

thanks for the help pete. i tried it out and it worked as advertised. however, it does seem to be alot of programming just to pull up some text. is there an easier way to do it or is there pretty much only one way to pull text from an outside file for use in a program?

ive been racking my brains for the last couple days trying to use your prgram but simplify it a little. also, i dont particulary care for the scrolling text and would rather have a full page of text come up, the ppl read it, press a key, and a new full page of text comes up.

also, is there a limit to the amount of characters allowed for a string variable? i thought it was 256 or somewhere around there but im not 100% sure. i was almost even thinking of assinging several sentences to a string variable and retrieving it from a random access file. do you think this way might be feasible or is your idea a better way to go about it?

 
 Respond to this message   

(Login The-Universe)
Admin

Re: thanks pete but...

February 4 2009, 5:58 PM 

If you are willing to make your text screens first and then read them into a screen, sure, you could do that.

CLS
OPEN "myfile.txt" FOR INPUT AS #1
LOCATE 2, 1
FOR I = 1 TO 23
LINE INPUT #1, TEXT$
PRINT TEXT$
NEXT
CLOSE #1

----------------------------------

You would need to write your text files in NOTEPAD. Just make sure you use no more than 23 lines or whatever the max amount of lines per page you want in each text block. You could use EOF to separate more than one text block; so, when the program reads the EOF, it exits to a key input routine and waits.

APPLES
ORANGES
PEARS
EOF
CAR
TRUCK
EOF
CAT
DOG
PIG
FROG
EOF

-------------------

To get CAR and TRUCK to show on the screen, I would save the file above as "myfile.txt" and read it as follows:

CLS
OPEN "myfile.txt" FOR INPUT AS #1
HP% = 2: REM Find the second text block.
I = 1
LOCATE 1, 1
DO UNTIL EOF(1) OR I > HP%
LINE INPUT #1, TEXT$
IF TEXT$ = "EOF" THEN
I = I + 1
ELSE
IF I = HP% THEN PRINT TEXT$
END IF
LOOP
CLOSE #1

--------------------
Pete

PS: You also need to make sure each text line in NOTEPAD does not exceed the number of columns in your text screen. SCREEN 0 has a max of 80-characters.

Also 23,734 characters is the max string length. Go figure.

 
 Respond to this message   

(no login)

thanks pete!! this helped me alot!

February 5 2009, 3:02 PM 

lol i didnt mean to critisize your first program pete, but there was alot of commands and lines in there that i didnt fully understand. my knowledge of qbasic, although growing, is still in its baby stage and i want to be able to understand the reasoning behind everything i put in to my program. it would be pretty embarrassing if someone asked me how i was able to do such and such and i wouldnt be able to tell them. for me, learning the mechanics of the commands is more important than shortcutting it.

this 2nd programs u made up is right up my alley. i actually understand and know all the commands used in that one and its one that probably fits my qbasic knowledge a little more. once again, thanks for all your help pete. you and clippy have been big helps with me creating my game. im hoping to release an updated version within a week. i havent done too much more than the last one, but redid alot of the code to fix text to proper case, 1 key entrys, removal of all sleep statements, few more options made available, and some nice upgrades to make the wargame experience a little more user friendly.

 
 Respond to this message   

(Login The-Universe)
Admin

You're welcome...

February 7 2009, 5:01 PM 

I'm happy the solution works for you. I see most people here as coders first. I think I see more of a software engineer in you. In other words, an engineer is someone who is more inspired and concerned about what the program needs to do than he is about how to get it to do what he wants it to do. I think I read somewhere that the engineer positions will outnumber the demand for coders. That's because, unfortunately, coders have developed so many libraries that there is not the high demand for custom made coding anymore but there is still the demand for different games and applications for various tasks to at least compete against current apps if not be completely innovative in nature.

Continued good luck with your project,

Pete

 
 Respond to this message   

(no login)

lol one more question pete

February 12 2009, 7:21 AM 

ok, i have done a little research on the CHAIN command but still dont fully understand how to write it into a program. from what i have been reading, CHAIN allows you to 'connect' 2 seperate programs together, but once you end one program, it will go back to the beginning of the other one. am i correct with this assessment? i looked into the FAQ about CHAIN, but there isnt much there to help a novice like myself.

my point in asking is because if i can use CHAIN in my program, i could use it to connect my main program with the instructions. i think it would be alot easier using CHAIN than to rewrite the instructions to a RA file and pull it up. this would save me time as well as making it easier for me to modify the instruction text should i need to.

so, the main question im getting at is this: how do i use the CHAIN command in my program and does each program need the CHAIN command?

does it go something like this?

?"(I)nstructions"
?:?"what is your choice"
DO:A$=UCASE$(INKEY$):LOOP UNTIL A$ <> ""
SELECT CASE A$
CASE "I":CHAIN INSTRUCT.BAS
END SELECT


once again, thank you in advance for your help pete or anyone willing to help a qb novice

 
 Respond to this message   
Clippy
(no login)

CHAIN is cool

February 12 2009, 10:02 AM 

You use CHAIN like this:
CHAIN "INSTRUCT" 'you don't need the BAS or EXE extensions
NOTE the quotation marks!

It will automatically look for the extension BAS if used in a BAS module.
The same is true after compiling to EXE. Both modules must be the same extension! Not using the extension saves having to edit the CHAIN calls later when compiling.

If you want to pass information to another module you can use COMMON SHARED variables. All modules will then require the EXACT same COMMON SHARED statements however. You can only compile with BRUN45 included!

I usually just pass the values in a Information file (.INF) so that I can compile standalone EXE files.

Yes, the CHAIN always goes to the start of the module. However if you pass a line number you can set up each module to start at that line number.

GOTO linenumber 'near start of module

Ted


 
 Respond to this message   

(no login)

thanks clippy/ few more questions

February 12 2009, 3:35 PM 

by modules do you mean seperate programs or SUBS , which i tend to call modules lol?

the reason for my wanting to CHAIN the instructions is to save space. my program is already at 200kb and by making the instructions sub into its own seperate program, it would save me about 34kb in space. there are no variables involved in this sub and about 95% of it is text.

now , is there a limit to the amount of programs you can CHAIN together?

thanks

 
 Respond to this message   

(Login burger2227)
R

I don't know of any limit

February 12 2009, 4:37 PM 

Modules are the BAS files or programs. Actually they are called programs when they are compiled. SUB's are subordinate modules. Both can do the same things usually.

You can CHAIN any code to another module. You could even put several SUBs into a separate module. You can put a menu in one and game code into several modules. You could also LINK the modules without CHAIN. That requires command line compiling. Pete does that often.

You will have to pass some variables eventually. I prefer a data file to using COMMON SHARED as I make stand alone EXE's. Each module can change the data before it goes back to a main module. You don't have to change Screen settings either.

You should use a Main module to call each CHAIN'ed module and return with another chain back to that Main module. If you don't, your last module must exit the routine.

Ted


    
This message has been edited by burger2227 on Feb 12, 2009 5:46 PM


 
 Respond to this message   
qbguy
(no login)

* No limit except maybe by the DOS 640k RAM limitation

February 12 2009, 5:57 PM 


 
 Respond to this message   

(no login)

hmmm...

February 13 2009, 3:46 PM 

i thought there was a 300 kb limit per program. i do know for a fact that the main module for any program can only contain 64kb (found that out the hard way, before i knew about SUBS). but even if this is true, if there is no limit to tha amount of programs i can chain together, then my space worries are now officially over lol.

i am also working on creating a true online multiplayer version of the game. right now, its only single player (although there are 20 cpu controlled players as well). the only snag i have is the need for a dedicated server, unless any of you guys know how to transfer variable data between several computers lol.

thanks for your help clippy and qbguy.

btw, how exactly do u compile a qb program and what are the benefits of doing so?

 
 Respond to this message   

(Login burger2227)
R

You need QB4.5 or above to compile programs

February 13 2009, 4:57 PM 

Look in your RUN Menu.

When using CHAIN, you will have to compile all of the modules or it won't work. The largest module I ever compiled was almost 100K. If you use COMMON SHARED to pass values then you need to Include BRUN45.EXE.

The main benefit is that you can run the program without needing a QBASIC folder. So you can just send the program to anybody. Even grandma.

Ted


    
This message has been edited by burger2227 on Feb 13, 2009 4:58 PM


 
 Respond to this message   

(no login)

more questions on compiling

February 13 2009, 9:31 PM 

i have qbasic 7.1 so i should be able to compile it

is 100kb the limit to the size of a program you can compile?

so it turns the bas file into an exe file? its obvious advantages would be the ability to run it without qbasic. but what are the disadvantages with compiling a program? would a compiled program be harder to edit if you would wish to expand it? once compiled, can a program be 'uncompiled'?

i dont think i will need to use COMMON SHARED, as i can easily retrieve any variables i need from the RA files and the main SUB i wanted to turn into a seperate program and CHAIN is mainly all texts (instructions to the game). this would save me about 34kb in space from the main game program


 
 Respond to this message   

(Login burger2227)
R

Re: more questions on compiling

February 13 2009, 10:52 PM 

The size of a compileable file is based on what types of code you are using in the module. So there is no set limit.

You cannot edit or uncompile the EXE program. You only have to make changes to the original module and compile it again. I would wait until your program is done unless you want to check if it will compile.

Ted

 
 Respond to this message   

(no login)

can u give an example?

February 14 2009, 10:41 AM 

of what types of code limits the compilability of the program?

right now, all i pretty much have is a bunch of SUBS, some INKEY$ and CASE statements, some GOTO and GOSUBS, and a RA file that contains the data for the game. i guess ill just try it to see if it will compile, making a backup copy before hand just in case

im going to post the latest version tomorrow. this version is not the completed product, but i would like some comments and/or suggestions for it.

 
 Respond to this message   

(Login burger2227)
R

* Large arrays, double number values, lots of PRINTS.

February 14 2009, 5:26 PM 


 
 Respond to this message   

(no login)

well i tried to compile it

February 15 2009, 7:31 AM 

and got 2 errors. one, out of memory error and then it couldnt find the file QBX. it only allotted my 45,018 bytes of memory , which doesnt seem like very much. thats only 45kb. and right now, my program is almost 200kb. i know i am opening a whole new can of worms here, but how do i allot more memory to allow the game to compile?

 
 Respond to this message   

(Login burger2227)
R

You are going to have to break the program into more modules

February 15 2009, 8:52 AM 

Such as a menu module, printing module, etc. You can also save memory by using separate SUB procedures not in the main code. When a sub program is called, it only uses memory until it is exited.

Large or numerous arrays can use up memory too. Try to make arrays that can be used for multiple purposes. Such as one graphic array to hold all GETs and PUTs.

Printing can create "Out of string space" errors when you print a lot in the main module code. Just breaking the prints up into SUB calls can alleviate the problem.

Don't even try to compile anything near 100K.

Ted

 
 Respond to this message   

(no login)

uhhh....

February 15 2009, 10:58 AM 

i already have about 20 SUBS and my main module is only 14kb, plenty of space. also, my main mod doesnt contain alot of text. most of the main mod are equations and things like that

lol well i guess for now, my game is going to be strictly run by qb lol

 
 Respond to this message   

(Login burger2227)
R

What is the module size including the SUBs?

February 15 2009, 12:43 PM 

I thought you said it was over 100K. You need the total BAS file size shown in DOS or Windows.

If you are working mostly with Integers, then put DEFINT A-Z above the SUB DECLAREs. If you need Single or Double values, define them separately.


 
 Respond to this message   

(no login)

now i understand what you mean

February 17 2009, 2:06 PM 

by more modules, you mean to break up the one program i have now (wargame4) into many seperate programs linked with CHAIN statements. i dont know why i didnt realize this before, lol i guess by modules you meant SUBS. sorry, im still learning my terminology of QB commands and sayings.

once everything is broken up, then does each program need to be compiled or will QB compile them all once you compile the main program?

this should actually be fairly simple to fix actually. ill create a new program which will only feature the main menu and then from there, CHAIN all my options (advisors, food market, bank, covert ops) from there. each option would be its own program and once it exits those, it will CHAIN right back to the beginning of the main menu program. this should mostly be a copy/paste type of edit for the most part.

lol i bet everyone saw my last update i just posted a few days ago and thought, 'what the hell is this guy doing?'. the game might not be able to be compiled yet, but it does run with QB.

any comments, thoughts, or ideas on the game would be extremely helpful. because of the help of you guys, i have done alot to improve it, and i wouldnt have even been able to fathom some of the ideas i have been given.
thanks alot guys.

 
 Respond to this message   

(Login burger2227)
R

I would only CHAIN or LINK when necessary

February 17 2009, 5:27 PM 

Try to keep your sub programs in the same modules unless they get too large. You just want to use a few modules probably. Keep the SUBs in the correct modules if you can.

1) Main menu
2) Game play
3) Read or write file data
4) Extreme Calculations

etc. You don't need 20 modules!

Ted

PS: Are you the same Mike as in the main Qbasic Forum?

 
 Respond to this message   

(no login)

RE: CHAIN

February 17 2009, 5:54 PM 

well, i dont play on having 20 chains or so, but i do plan on having 5-6 of them at least. my menu mod could contain several menu options (smaller ones ), while the larger ones like my advisors would be a whole mod by itself (each advisor could have its own SUB within the mod). the editor would definitely have its own mod. well, i guess ill have 7-8 of them lol. it is a pretty large program and its only about 75% complete, so theres still alot to go.

and even though i have posted in the main forum at times, theres 2-3 mikes running around here. you can always tell mine because i always use the same email address when u click on my name.

 
 Respond to this message   

(Login The-Universe)
Admin

URL* to multi-modular programming

February 15 2009, 9:06 AM 

http://www.network54.com/Forum/13959/message/1104708146

 
 Respond to this message   

(no login)

i understand some of the program

February 18 2009, 4:21 PM 

in the URL, but that SHELL command totally baffles me. i have no idea what it does or its purpose. can u elaborate for me? is it even required to chain several mods together? as for CHAIN and using COMMON SHARED, for the most part, i shouldnt have to use COMMON SHARED because im transfering all my data with a RA file. i will pull it at the beginning of every mod and save the updated data at the end of every mod.

if a mod can only be 100kb at most to compile, then i will have to make at least 2-3 more mods. since i have posted my updated game, i was hoping someone would have looked at it and given me some more pointers.

 
 Respond to this message   

(Login burger2227)
R

SHELL is used to go to DOS

February 18 2009, 4:50 PM 

Whatever DOS commands are used, DOS does the work. You could also just use the DOS command line. I gather you don't know the correct commands in DOS.

Just insert your filenames where Pete gave examples. BC is the Qbasic compiler on steroids. The O/S/E/X is to allow a better compilation than the IDE (QB editor) would allow. You need to compile each BAS file separately and then LINK them together using your module file names.

Where is your QBX file? Keep all of the PDS (7.1) files and your modules in the same folder or you will have to use the DOS paths!

Ted




 
 Respond to this message   

(no login)

i guess i dont need SHELL

February 19 2009, 12:17 PM 

ive started to break wargame4 down into seperate mods. so far ive created an advisors mod and a main menu mod. once i created the advisor mod, i attempted to compile it and it worked! apparently, there is a 45 kb limit to the size of mods i can compile. i left out the SHELL command and just a simple CHAIN "advisors" line did the trick.

 
 Respond to this message   

(Login burger2227)
R

* Just remember CHAIN only links to another EXE / BAS file.

February 19 2009, 12:30 PM 


 
 Respond to this message   

(no login)

what is an OBJ

February 23 2009, 6:56 PM 

when i compiled one of my mods, it created 2 files; an exe file and an obj file. i know what the exe file does, but what purpose does the obj file serve? being curious, i deleted that file from my folder and ran the game. all functions of the game still seemed to work correctly without it.

can anyone elaborate what exactly the OBJ file does and is it really nessessary for the game to run properly?

 
 Respond to this message   

(Login MCalkins)
R

object files

February 23 2009, 8:50 PM 

It is an intermediate file between source code and final executable. It is not required to run the final executable.

When you assemble the source code for a DOS .EXE file, the output is an .OBJ file for each module. This file contains the machine code that was generated by the assembler (or the compiler itself), as well as information for imported and exported symbols (such as the entry points for procedures, and the locations of shared variables). One or more object files and libraries can be linked into a single .EXE file by a linker. The linker patches references to symbols, I believe.

So, you can think of the process as follows:

source code --> compiler --> assembly code
assembly code --> assembler --> object file
object file --> linker --> final executable

some development tools can skip steps in this process. For example, I don't think TCC or QuickBASIC require assemblers; I think they can output object files directly.

Regards,
Michael

 
 Respond to this message   

(Login burger2227)
R

Object files can be used to make a Library file.

February 24 2009, 12:02 PM 

LIBWIZ can make them into Library files. I found that on the web. You usually just make SUB programs and compile the code. Then you can Include the Library for certain programs.

I never was successful, so I just delete them. LOL

Ted

 
 Respond to this message   
Current Topic - Scrolling 'help' menu for Mike. (Reagan speech provided as test data.)
  << Previous Topic | Next Topic >>Return to Index  

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums