Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does this work?
#1
Im making a text-based RPG and i have made an simple level-up system for it... now i wonder if it works...

IF experience$ = "45" THEN
level$ = level$ + 1
Attack = Attack + 4
Defence = Defence + 2
Magic$(0) = "flare"
CLS
PRINT "Level up""
PRINT "Gained some stats and learned magic flare"
SLEEP
CLS
GOTO PlayerX, PlayerY
Reply
#2
ok, that looks ok, but a few suggestions.

1. The first line should be
Code:
IF experience > "45" THEN
it is always good practice, because if you are adding decimals, then it can go past 45 without actually being 45 if you see what I mean.
And dont have the $ at the end. It isnt used for holding text.

2. You are using a variable level$. Dont. If this variable is meant to hold numbers, dont have the $ at the end. That signifies that it is a string, used for holding Text.

3. What do you mean by this?
Code:
GOTO PlayerX, PlayerY

GOTO means to goto a certain place in the program, not locate the cursor at position PlayerX, PlayerY.

if you are wanting to position the cursor, use:
Code:
LOCATE PlayerX, PlayerY

Otherwise, it looks ok. Wish you luck on your project. Tongue
Reply
#3
ops... hehe... sorry... that
GOTO PlayerX, PlayerY was another question...
how do i make so when u gain a level and the lvl up message is shown, how do i make so it will go back to where u was before u leveled up..
Reply
#4
ops... sorry for my bad english... no good at it
Reply
#5
You're worse than a translator. Anyway there are two answers to your question:

1. Use GOSUB
2. Use SUBs

Now, GOSUB is a small set of instructions which are written inside the program body. For example:

PRINT "my name is foo"
GOSUB printsomething
PRINT "I am back!"

END

printsomething:
PRINT "I printed something"
RETURN

You should always write GOSUB after the "END" statement to prevent accidental execution of the code.

Second answer is my choice. I would use SUBs rather than a GOSUB. SUB is a different sub-program(a small program inside the program) also known as SUB-ROUTINE.

A sub has three parameters to be defined:
1. The Sub-name
2. The return type
3. The arguments

example: FUNCTION MYSUB%(arg1$, arg2%)

MYSUB = name
% characterises that it will return an integer
and arg1$, arg2% are the arguments

FUNCTION MYSUB%(arg1$, arg2%)
PRINT arg1$, arg2%
RETURN 0
END FUNCTION

when you want to call a sub you just type:

returnedval% = MYSUB%("foo", 56)

Thats also known as a function.

PRINT "my name is foo"
temp% = MYSUB%("blah", 342)
PRINT "I am back!"

You see both SUB and GOSUB allow your program execution to continue after they have finished performing their function =).
Reply
#6
Quote:You're worst than a translator.

Worst than???

who's bad at english?!

nah, j/k =D
Reply
#7
My mother tongue isnt English but i am pretty good at my spelling and grammer.
Reply
#8
Quote:grammer.

It is grammar Wink

In Spanish we call this "ir de enterao".
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#9
nath picking apart somebodies english? Naah, can't be! :lol:
Reply
#10
I just nitpicked him 'cause he was nitpicking Tongue

I just found funny someone writing "i am pretty good at my spelling and grammer" and misspelling "grammar" (no offence intended!).
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)