Author Topic: My really crappy game...Dragonslayer  (Read 11737 times)

0 Members and 1 Guest are viewing this topic.

tenniskid493

  • Guest
My really crappy game...Dragonslayer
« Reply #45 on: March 17, 2006, 05:39:00 pm »
QuoteBegin-g28401+Mar 17 2006, 21:11-->
QUOTE (g28401 @ Mar 17 2006, 21:11)
I am using the Lbl and Goto commands

99% of the time, lbls and Gotos can be avoided.  The only time they absolutely can't be avoided is if you are using the Menu( command.  The reason they are bad is because they can cause memory leaks.  This means that, whenever you enter a loop, the calculator stores some data telling it to look for an end.  When it reaches the end of the loop, this information is opened up again.  However, if you break up a loop with a Goto so that it never reaches the end, that memory space is wasted, thus causing a memory leak.  This will lead to an annoying Err:Memory message that will cause you to have to quit out in the middle of the game.  Gotos and Lbls can always be replaced with If:Then statments.  Instead of saying:
c1
-->
CODE
ec1If A=5
Goto 99c2
ec2
you could say
c1
-->
CODE
ec1If A=5
Then
(Put what was at Lbl 99 here)
Endc2
ec2

If you are performing the same function many times in different spots throughout the program, then you might want to make sub-programs.  Then you would do
c1
-->
CODE
ec1If A=5
prgm???c2
ec2
Where you put whatever was at Lbl 99 into prgm???

Hope this helped you out.  If you still need more help or have any questions, feel free to ask.  Also, if you have a specific question about your code, you could post a portion of your code and we could have a look at it and let you know the best way to go about what you want to accomplish.

g28401

  • Guest
My really crappy game...Dragonslayer
« Reply #46 on: March 18, 2006, 02:04:00 pm »
I have a couple questions:
Text Decoders? What's This?
How can you use one subroutine for many functions?
Many more, but can't think of them all ;O

Offline Spellshaper

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1690
  • Rating: +0/-0
  • This is me. Or maybe not.
    • View Profile
My really crappy game...Dragonslayer
« Reply #47 on: March 19, 2006, 01:27:00 am »
1. A text decoder is a prgm that takes the contents of a string and displays it as text. This saves a lot of space if u use many dialogues, but is a bit slower than text(

2. For example: Write your function inside an if-construction like

If var= something
then
do stuff
End

and repeat this for every function. That way, u have one function library to call upon instead of many lil prmgs.

g28401

  • Guest
My really crappy game...Dragonslayer
« Reply #48 on: March 19, 2006, 11:22:00 am »
Ok, If you could translate this into *simple* terms I could understand I would be thankful :Dbiggrin.gif

Offline Spellshaper

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1690
  • Rating: +0/-0
  • This is me. Or maybe not.
    • View Profile
My really crappy game...Dragonslayer
« Reply #49 on: March 19, 2006, 11:37:00 am »
1. try http://www.ticalc.org/archives/files/fileinfo/378/37880.html

2. Instead of writing a function every time it is needed, put them into 1 prgm

example:

PROGRAM:LIB
:If A=1
:then
:For(A,0,100    /this just slows down the prgm...
:End
:End
:If A=2
:then
:12
:Asm(prgmCODEX    /this shuts down the calc until ON is pressed, needs CODEX
:Repeat getkey
:End
:End


to call upon function1, do

:1->A
:prgmLIB


for function2

:2->A
:prgmLIB