Author Topic: [83+ xLIB] Programming Grayscale Help  (Read 3317 times)

0 Members and 1 Guest are viewing this topic.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[83+ xLIB] Programming Grayscale Help
« on: July 15, 2006, 06:30:00 pm »
Here is the code that I was wondering if it could be optimized and it would be much appriciated if this was done before 1 today because after this ima be gone for three weeks.Also another problem is I cant find the right place to put the AI. Cause before the While 1 it only runs when palyer moves. After Repeat it runs so much that getkey doesnt register. At the end it dont move until user moves.

Key:
prgmGROUT3E= Enemy grayscale
prgmGROUT3G=Person grayscale
prgmGAI=Enemy AI(sorta)
->=store

QUOTE
prgmGENGINE:
real(0,1:->S:->T
44->I:-34->M:44->J:-26->P
real(1,I,36,1,8,7,0,0,0,0,1
While 1
prgmGROUT3G:prgmGROUT3E
real(1,I,36,1,8,7,0,0,0,0,1
prgmGROUT3G:prgmGROUT3E
prgmGROUT3G:prgmGROUT3E
Repeat K
getkey->K
prgmGROUT3G:prgmGROUT3E
End
If (K>=24 and K<=26):Then
prgmGROUT3G
real(1,I,36,1,8,8,2,0,3,0,1
End
prgmGAI
prgmGROUT3G
I-8(K=24)+8(K=26->I
If K=25:Then
For(N,1,4
Pt-On(I,M
End
Pt-Off(I,M
-34->M
End
End

prgmGAI:
real(1,J,19,1,8,7,1,0,0,0,1
prgmGROUT3G:prgmGROUT3E
randInt(1,3->O
prgmGROUT3G:prgmGROUT3E
real(1,J,19,1,8,7,11,0,0,0,1
J-8(O=1)+8(O=2)->J
real(1,J,19,1,8,7,1,0,0,0,1
prgmGROUT3G:prgmGROUT3E
If O=3:Then
prgmGROUT3G:prgmGROUT3E
For(N,1,4
Pt-On(J,P
End
prgmGROUT3G:prgmGROUT3E
Pt-Off(J,P
End
Please help o.oblink.gif
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[83+ xLIB] Programming Grayscale Help
« Reply #1 on: July 19, 2006, 11:38:00 am »
Well there is a gs guide here made by CDI, other than that I could help a little with your code. Btw, why are you Pt-On four times on the same spot?

c1-->
CODE
ec1For(N,1,4
Pt-On(I,M
Endc2
ec2

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ xLIB] Programming Grayscale Help
« Reply #2 on: July 19, 2006, 11:57:00 am »
he might have made a typo

Dragon__lance

  • Guest
[83+ xLIB] Programming Grayscale Help
« Reply #3 on: July 19, 2006, 01:22:00 pm »
as far as your code gos,some simple optimisations are:

In the very beginning,replace the ->S,T with DelvarS,DelvarT.And instead of real(0,1,just have real(0.
Now i noticed you use seperate programs to run the grayscale.My advice is this,if you plan on having a lot of programs in the game,then just copy that program code into the main engine instead of having it as a subroutine.Calling subroutines is slower than just having an if/then statement,especially with a lot of programs involved ;)wink.gif

As for the AI problem....the only place i see to put it is the Repeat Getkey loop.To make it not run so much,you might have to set up ur own interrupt:

:not(X->X (x being interrupt variable)
:if X:prgmGAI

there are numerous other ways to do this :)smile.gif


Zeromus

  • Guest
[83+ xLIB] Programming Grayscale Help
« Reply #4 on: July 19, 2006, 04:22:00 pm »
@d_l: NEVER skimp code from xLIB, I learned that the hard way, if you include the full code it works fine.  

Dragon__lance

  • Guest
[83+ xLIB] Programming Grayscale Help
« Reply #5 on: July 20, 2006, 02:10:00 pm »
i agree,but i'm very use to just using real(0,instead of real(0,1,has nvr crashed for me yet.

Liazon

  • Guest
[83+ xLIB] Programming Grayscale Help
« Reply #6 on: July 21, 2006, 12:35:00 am »
That's because real( is a regular Ti-OS command.  I don't know what it does, but I think normally it should return the real part of a complex number.  I think.

Since xlib won't parse it, Ti-OS will parse it and there will be no crash... hopefully.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ xLIB] Programming Grayscale Help
« Reply #7 on: July 21, 2006, 09:22:00 am »
I always use real(0 until I found out that trick to check if xlib is installed or not I never knew there was a sec argument o.oblink.gif

threefingeredguy

  • Guest
[83+ xLIB] Programming Grayscale Help
« Reply #8 on: July 21, 2006, 08:16:00 pm »
Yeah, but it doesn't matter. I think adding a second argument will cause an error if xLIB isn't installed anyway.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ xLIB] Programming Grayscale Help
« Reply #9 on: July 22, 2006, 01:10:00 am »
yeah i like how you can detect if its installed with one argument at prgm startup