I'm currently rewriting an old Commodore C64 game in Quest5 and have hit a snag. ( I find this is the best way to learn a new language as I know what currently happens and can check that I have it right)
At the start of the game, there are 4 objects that are placed in one of 7 random rooms (rooms 4 - 10) but never in the same room as each other. The BASIC code (its actually a Quickbasic port of the C64 code) for this is...
5000 FOR x = 1 TO 4
5010 t = INT(RND(1) * 7) + 3
FOR y = 1 TO x - 1
IF VAL(ob$(y, 1)) = t THEN GOTO 5010
NEXT y
ob$(x, 1) = STR$(t)
NEXT x
I have tried various ways using scripts for each object but haven't had any success as yet. I think I may need to code a function for this and then call it from the game startup script. Can anybody give me any pointers as to whether this is the right approach or should I be doing something different (and probably simple)?
Thanks.