Register    Login    Forum    Search    FAQ

Board index » Deutsche QBasic Foren (german) » Rund um QBasic und QuickBasic




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: GOTO Variable ?
 Post Posted: Sun Jan 22, 2006 5:13 pm 
 
Hallo.
Ich schreibe grade ein Textadventure/RPG.

hier ein auszug aus dem code:

Code:
REM (...)

GOTO 40

35'Inventar
?
? "Du besitzt";g%; " Goldstuecke und in deinem Rucksack befinden"
? "sich folgende Gegenstaende :"
?
SLEEP
GOTO wo%

40 'In deinem Haus[Hier beginnt das eigentliche Spiel]
CLS
41
Let wo%=41
?       "Du befindest dich jetzt in dem alten Holzhaus, in dem du lebst."

INPUT "Was willst du nun tun "; ent$
IF ent$="i" THEN GOTO 35
...
...
SLEEP


und mein problem ist folgendes: wie kann ich von jedem "raum" das program zum inventar sprigen lassen und zum SELBEN raum zurück. Das GOTO variable funktioniert ja nicht....gibt es eine möglichkeit diese option einzubauen ?

(Anstatt Goto wo% kann ich ja nicht GOTO 41 schreiben weil er ja dann immer wieder zum selben raum springen würde. Es muss ja individuell sein !! Wenn ich das inventar in raum 55 aufraufe will ich ja nicht zu raum 41 zurück )


Top 
  
 
 Post subject: Re: GOTO Variable ?
 Post Posted: Sun Jan 29, 2006 9:14 pm 
Offline
Administrator

Joined: Wed Feb 13, 2002 9:15 pm
Posts: 29
Location: Germany
Mit GOSUB / RETURN sollte es funktionieren:

Code:
GOTO 40

35'Inventar
?
? "Du besitzt";g%; " Goldstuecke und in deinem Rucksack befinden"
? "sich folgende Gegenstaende :"
?
SLEEP
RETURN

40 'In deinem Haus[Hier beginnt das eigentliche Spiel]
CLS
41
? "Du befindest dich jetzt in dem alten Holzhaus, in dem du lebst."

INPUT "Was willst du nun tun "; ent$
IF ent$="i" THEN
  GOSUB 35
  GOTO 41
End IF
...
...
SLEEP

_________________
crossroads (QBCafe Forum Admin)


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

Board index » Deutsche QBasic Foren (german) » Rund um QBasic und QuickBasic


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
News News  Site map Site map  SitemapIndex SitemapIndex  RSS Feed RSS Feed  Channel list Channel list


phpBB SEO