Qbasicnews.com
Ok, trying to port a roguelike project to FB.... - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+---- Forum: FB Projects (http://qbasicnews.com/newforum/forum-16.html)
+---- Thread: Ok, trying to port a roguelike project to FB.... (/thread-5676.html)

Pages: 1 2


Ok, trying to port a roguelike project to FB.... - Jocke The Beast - 01-14-2005

As the complete FB-newbie I am, I will need some help here. Trying to compile a roguelike-project gives me alot of errors....some I have fixed and some I havn't fixed yet...

Anyways, FB has some problems with this code, anyone know how to fix it?

Code:
FOR x = MaxX TO 1 STEP -1
FOR y = MaxY TO 1 STEP -1
  IF DungeonLayer(x, y) = STAIRSUP THEN
   IF MonsterLayer(x, y) = 0 THEN
   xpos = x
   ypos = y
   CALL PlayTheGame: END
   END IF
  END IF
NEXT y
NEXT x

Thanks!


Ok, trying to port a roguelike project to FB.... - na_th_an - 01-14-2005

What's the *exact* problem? i.e. post the fbc error Wink


Ok, trying to port a roguelike project to FB.... - Jocke The Beast - 01-14-2005

Oki... :oops:

Error message:
Quote:error 50. Expected scalar counter, before: '='


Code (where FOR x = 1 TO 12 is the linenumber the error hits):

Code:
FOR x = 1 TO 12
  GItemACmod = items(CEquipment(x).ILINumber).IAC + GItemACmod
  GItemACmod = CEquipment(x).ILACBonus + GItemACmod
  GItemToHitmod = CEquipment(Equip).ILToHitBonus + GItemToHitmod
  GItemToDammod = CEquipment(Equip).ILToDamageBonus + GItemToDammod
NEXT x

The last post (with code) can be ignored :oops:


Ok, trying to port a roguelike project to FB.... - Z!re - 01-14-2005

It means that the x is locked, somehow, try changing it to xcounter, or something (prolly wanna go with xc, less typing, hehe)


Ok, trying to port a roguelike project to FB.... - v3cz0r - 01-14-2005

Is X an function argument passed by reference? Than it can't be used.. declare the arg as BYVAL or then use another name as Z!re said.


Ok, trying to port a roguelike project to FB.... - Jocke The Beast - 01-14-2005

Thanks guys. It was like you said Vic...fixed now.

Ok, next error :wink:

Quote:error 10 : expected '=', found: 'SEG'

And the code where the error is:

Code:
SUB ScreenFun (arg%)

SELECT CASE arg%
  CASE 1  'Save the Screen
    DEF SEG = &HB800
    FOR x = 0 TO 4000
      SCREENSAVE(x) = PEEK(x)
    NEXT x
    DEF SEG
  CASE 2  'Restore the Screen
    DEF SEG = &HB800
    FOR x = 0 TO 4000
      POKE x, SCREENSAVE(x)
    NEXT x
    DEF SEG
END SELECT

END SUB



Ok, trying to port a roguelike project to FB.... - Ryan - 01-14-2005

Yo go Jocke. hehe I have some old random map generator code I was thinking about messing with in FreeBASIC. Anyways, here's the problem from keywords.txt in the docs folder:

Quote:DEF SEG Statement (reason: segments are not needed in 32-bit flat mode)



Ok, trying to port a roguelike project to FB.... - Jocke The Beast - 01-14-2005

Hi there Ryan...hehe... you know me, within ten years I might start to use gfx in my games :wink: Textmode rules 8) Btw, I should as you this: when making texmode games using FB is there something special one should think about? Is the chr codes the same as in qb for example?


Ok, trying to port a roguelike project to FB.... - Anonymous - 01-14-2005

Yeah, the same one's are used, though I seem to remember having a little trouble with a few. It seems some of the color stuff is different, and two other problems (unless they've been fixed in the recent version) are the mouse being on all the time and the cursor always blinking. It's also kind of slow for refreshing (like the chunky text scroll in my demo). :wink: Basically, (no pun intended) you're using a more advanced language which can't match up to QB's raw text display dominance. Tongue The big thing is just speed, like you may have noticed in Zap's remake.

As for the saving/restoring screen stuff.. is that really necessary for the gameplay? If not, I'd say just cut it out.


Ok, trying to port a roguelike project to FB.... - Ryan - 01-14-2005

^^^^^ Whoops, forgot I logged out. Using a public computer.. though I doubt anyone at my school has ever even heard of QBasic. ^_^