Text rpg question - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: Text rpg question (/thread-326.html) |
Text rpg question - Placeborick - 03-03-2003 Im very new to qbasic and have just learned a few simple bits here and there. To help myself get better im currently trying to make a mini TEXT only rpg type thing, basically a small shopping mall type simulation, where i can walk around and look in shops (kinda sad but i need to learn this) :bounce: I have managed to programme all the 'rooms' of my mall but making commands specific to a certain room is causing quite a few problems for me. In general, north east south west for each room was easy i used the if and then commands. I want to set specific key promts in rooms like shops though: eg: buy 'item' in a shop, which i want only to be applicable in that particular room and nowhere else. (if this makes sense) can anyone help me? im very new to all this... :-? so im a bit slow at the minute hehe Text rpg question - na_th_an - 03-03-2003 Hmmm, just use IFs in combination with what is called "flag variables". These kinds of variables store numeric values that have an useful meaning. For example, you can have a flag to store which kind of room you are, for example, let's say Code: ' the RoomType% variable will equal... You only have to set it correctly for each room, and just make an IF. I don't know what kind of data structure you are using to store the room data, or maybe if you are hard-coding them with PRINTs and GOTOs (I would not do that!)... In Sum, I don't know if I am helping you, mostly because I don't know how you are implementing your game hmm - Placeborick - 03-03-2003 ok i kinda understand now but im still too crap to put that into use, iv been programming about 3 days hehe and it aint goin all to well never done it before do i set these room types as an array, and is there a way i can customise each room type somehow after the array setting:-s sorry if i make no sense Text rpg question - na_th_an - 03-03-2003 The best thing is to have everything inside a data structure. Check for TYPE commands. You can look: 1. In QB help. 2. In tutorials (found in this site) 3. Do a SEARCH in this forum for "TYPE" and you'll find tons of info in past posts. Text rpg question - NovaProgramming - 03-05-2003 hey there Umm, let's see. Let's see if I got this right: So are you using a command menu such as Where would you like to go? 1-> Shoe Store 2-> Software Etc (and so on) _ <-- the input ? Oh i think I get it... so you can type in southeast and it would take you southeast, right? Well, if you are in a certain shop you can use the INKEY$ variable to program keys that would only work for a certain area what you should do is create a DO LOOP UNTIL loop where the user can input a key. You could have the movement instead of typing southeast northwest and so forth just be a diagonal pad something along the lines of q w e w is up, q is upleft (northwest) e is upright (northeast) a s d and soforth... z x c so your program could look something like this Code: DO NOVA@EDGEEMU.COM if you need more help than that, but I think that is fairly seflexplanetory. (did I spell that right?! ) -NOVA Text rpg question - ak00ma - 03-05-2003 Don't use "IF" in such cases. Better take "Select Case". Here ya go: Code: Key$=IINKEY$ Text rpg question - NovaProgramming - 03-06-2003 Thanks, I didn't think of that one. :lol: |