[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2009-08-09T16:15:24-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/2950 2009-08-09T16:15:24-05:00 2009-08-09T16:15:24-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19636#p19636 <![CDATA[EXP]]>

'just some code from the UpdateStats routine:

Code:

 IF gp& > 9999999 THEN gp& = 9999999 IF xp& > 9999999 THEN xp& = 9999999 ac% = 0 absorb% = 100 rfire% = 100 rcold% = 100 relec% = 100 rchem% = 100 hpmax = Level%(lvl, 0)     'these four lines mpmax = Level%(lvl, 1)     'check the Level% array str% = Level%(lvl, 2)     'for current stats tohit% = Level%(lvl, 3)

Statistics: Posted by coma8coma1 — Sun Aug 09, 2009 4:15 pm


]]>
2009-08-09T16:15:10-05:00 2009-08-09T16:15:10-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19635#p19635 <![CDATA[EXP]]>
here's the other two i promised

Code:

LevelUp: GetA abat = MID$(abat, 1, LEN(abat) - 1) + CHR$(34) + "^Your level has increased!!": a = abat: Text oldhpmax = hpmax oldmpmax = mpmax oldlvl = lvl lvl = 1 DO  lvl = lvl + 1  IF lvl = UBOUND(Breakpoint&) THEN EXIT DO LOOP UNTIL Breakpoint&(lvl + 1) > xp& abat = abat + "@^You are now level" + STR$(lvl) + ".": a = abat: Text UpdateStats abat = abat + "^Your Hit Points increase by" + STR$((hpmax - oldhpmax)) + ".": a = abat: Text IF mpmax - oldmpmax > 0 THEN abat = abat + "^Your Magic Points increase by" + STR$((mpmax - oldmpmax)) + ".": a = abat: Text IF Level%(lvl, 2) > Level%(oldlvl, 2) THEN abat = abat + "^Your Strength increases by" + STR$(Level%(lvl, 2) - Level%(oldlvl, 2)) + ".": a = abat: Text IF Level%(lvl, 3) > Level%(oldlvl, 3) THEN abat = abat + "^Your Chance to Hit increases by" + STR$(Level%(lvl, 3) - Level%(oldlvl, 3)) + ".": a = abat: Text RETURN

Statistics: Posted by coma8coma1 — Sun Aug 09, 2009 4:15 pm


]]>
2009-08-09T16:14:17-05:00 2009-08-09T16:14:17-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19634#p19634 <![CDATA[how i did it in DSQ]]>
My level-up and level checking code goes something like this... Both of these first two little chunks of code exist in my "Battle" routine where all combat takes place. The First part is the code that run s when you WIN the fight. Note the part where xp& is checked against the next levels experience breakpoint which is stored in a single dimension array called Breakpoint&() with enough elements to store the breakpoints for all experience levels. Also note that I've made both "gp&" gold and "xp&" experience long intergers because I want them to top out at 9,999,999 like some old Nintendo games do, and an regular integer wasn't big enough. Also note that when your level reaches the upperbound of the braekpoint array (ie: you've maxed out your levels) you cannot anylonger level-up.

Next is the sub routine, also in my Battle() sub, which actually adjusts the player's experience level and displays the fact on screen. "LevelUp"

Finally, I've copy and pasted a chunk of code from my "UpdateStats" routine which updates the players stats any time it's called. Among other things, it looks at a two-dimensional array which stores all of the vital level-specific stats for the player. One dimension is the experience level, while the other dimension is the statistics such as maximum hitpoints, maximum magic points, base strength, and base chance to hit. The part you're looking for is the last four lines there. See, I just used a simple array, which saves the trouble of a nightmare block of IF...THENs or a ginormous SELECT CASE.

Code:

YouWin: Draw.Map gp& = gp& + mgp xp& = xp& + mxp IF gp& > 9999999 THEN gp& = 9999999 IF xp& > 9999999 THEN xp& = 9999999 abat = abat + "^|080000You have defeated the " + mon$ + "!" a = abat: Text abat = abat + "^@Your|137000 experience@ increases by|137000" + STR$(mxp) ' + "@." a = abat: Text abat = abat + "^@Your|154000 gold@ increases by|154000" + STR$(mgp) ' + "@." IF lvl <> UBOUND(Breakpoint&) THEN                 '*  IF xp& >= Breakpoint&(lvl + 1) THEN abat = abat + "\" + CHR$(13) END IF                                             ' a = abat: TextExitBattle: UpdateTherm IF lvl <UBOUND> 9999999 THEN gp& = 9999999 IF xp& > 9999999 THEN xp& = 9999999 ac% = 0 absorb% = 100 rfire% = 100 rcold% = 100 relec% = 100 rchem% = 100 hpmax = Level%(lvl, 0)     'these four lines mpmax = Level%(lvl, 1)     'check the Level% array str% = Level%(lvl, 2)     'for current stats tohit% = Level%(lvl, 3)
I hope that helps someone somewhere. You'd need to dimension arrays and junk to run this code. It's ust too much to type out so I just copied and pasted it right outta my BAS file. any Q's post here. k, later! -come8coma1

Statistics: Posted by coma8coma1 — Sun Aug 09, 2009 4:14 pm


]]>
2009-05-16T13:42:02-05:00 2009-05-16T13:42:02-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19177#p19177 <![CDATA[thanks]]> Statistics: Posted by floogle11 — Sat May 16, 2009 1:42 pm


]]>
2009-05-14T23:22:08-05:00 2009-05-14T23:22:08-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19171#p19171 <![CDATA[EXP]]>
Use MID$ or RIGHT$ or LEFT$ to use parts of a string.
IF yes$ = "yes" OR yes$ = "Yes" OR yes$ = "YES" THEN LET Longsword = Longsword - "no" + "yes"
I this case, your IF statement only needs modified:

Code:

IF UCASE$(yes$) = "YES" THEN    Longsword$ = "yes"ELSE : Longsword$ = "no"END IF
Forget about LET! It is never necessary.

Ted

Statistics: Posted by burger2227 — Thu May 14, 2009 11:22 pm


]]>
2009-05-14T19:19:57-05:00 2009-05-14T19:19:57-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19166#p19166 <![CDATA[Does]]> HIT = 1
LET Longsword$ = "no"
IF Longsword$ = "yes" THEN LET HIT = HIT + 10
IF Longsword$ = "no" THEN LET HIT = HIT * 0
INPUT "You wanna buy a longsword?"; yes$
IF yes$ = "yes" OR yes$ = "Yes" OR yes$ = "YES" THEN LET Longsword = Longsword - "no" + "yes"

Statistics: Posted by floogle11 — Thu May 14, 2009 7:19 pm


]]>
2009-05-14T19:10:34-05:00 2009-05-14T19:10:34-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19165#p19165 <![CDATA[Thanks]]>

Statistics: Posted by floogle11 — Thu May 14, 2009 7:10 pm


]]>
2009-05-14T19:08:21-05:00 2009-05-14T19:08:21-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19164#p19164 <![CDATA[EXP]]>

Code:

let level=1let nextlevlat=5let score=0dorem all your game stuff.......if score>=nextlevelat thenlet level=level+1let nextlevelat=int(nextlevelat/2)+levelend ifloop
also, if you dont want to use 80 if statements, i suggest using 'select case'
example (your code modified):

Code:

let level=1let xp=0dorem all your game stuff....let xp=xp+1select case xpcase 50print "level up!"let level=level+1let xp=100case 200print "level up!"let level=level+1let xp=350case 350print "level up!"let level=level+1let xp=550case 550print "you win!"endend selectloop
and 1 more thing, you used exp as a variable, that is not valid because it as a function.

good luck with your new game!

Statistics: Posted by bongomeno — Thu May 14, 2009 7:08 pm


]]>
2009-05-14T18:51:03-05:00 2009-05-14T18:51:03-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19163#p19163 <![CDATA[EXP]]> LET LEVEL = 1
IF EXP = 100 THEN LET LEVEL = LEVEL + 1
IF EXP = 300 THEN LET LEVEL = LEVEL + 1

if they are every 200 points like your example here, then you can just divide EXP by 200

LEVEL = (EXP / 200) + 100

shouold do the same as all your IF statements

Statistics: Posted by MystikShadows — Thu May 14, 2009 6:51 pm


]]>
2009-05-14T18:24:11-05:00 2009-05-14T18:24:11-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19162#p19162 <![CDATA[Thanks]]>

And I was doing somthing like this...
Code:
LET EXP = 0
LET LEVEL = 1
IF EXP = 100 THEN LET LEVEL = LEVEL + 1
IF EXP = 300 THEN LET LEVEL = LEVEL + 1
And so on...

Statistics: Posted by floogle11 — Thu May 14, 2009 6:24 pm


]]>
2009-05-14T18:09:09-05:00 2009-05-14T18:09:09-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19161#p19161 <![CDATA[EXP]]>
The method will change if you want to increase at regular intervales (every 50 points for example) or if you have variable set values.

For example: if you want to increase every 100 points. Somthing like this would work

Code:

IF CurretnScore/100 = INT(CurrentScore/100) THEN   CurrentLevel = CurrentScore / 100END IF
Just change the 100 to the mumber of points you want the interval to be fore.

Hope this helps.

Statistics: Posted by MystikShadows — Thu May 14, 2009 6:09 pm


]]>
2009-05-14T16:50:34-05:00 2009-05-14T16:50:34-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=19160#p19160 <![CDATA[EXP]]> Statistics: Posted by floogle11 — Thu May 14, 2009 4:50 pm


]]>