Computer Science Canada

Problem with turing

Author:  krishon [ Sat Nov 23, 2002 2:27 pm ]
Post subject:  Problem with turing

hi, i just have a slight problem. I wuz just makin a program and then a message sayin "Implementation restriction - Block nesting too deep." I got a bit angry afta it kept on popping up. How can i fix it??

Any help will be greatly appreciated. It would be good if a reponse can come today or latest 2moro. thx Smile

Author:  Tony [ Sat Nov 23, 2002 3:40 pm ]
Post subject: 

my guess is that there's a problem with your nesting of something... posting your code would be helpful.

Author:  krishon [ Sat Nov 23, 2002 3:54 pm ]
Post subject: 

cls
exit when hitpointsamazon <= 0
elsif fightrunchoice = "run" then
randint (runawaychoice, 1, 2)
if runawaychoice = 1 then
Pic.ScreenLoad ("char-amazon.bmp", 1, 1, picCopy)
put "You have gotten away"
delay (2000)

this is around lines 783 to 791 of 1243. It says that message on the line:

elsif fightrunchoice = "run" then

if u need to, i could be able to send the actual file, but it requires the new version of turing, turing 4.04b

Author:  Tony [ Sat Nov 23, 2002 4:50 pm ]
Post subject: 

well it could be the line before that too...

You don't put "exit when" inside an if statement... just put "exit" if you need to get out of the loop.

If that is not the problem, try drawing a diagram of all your loops... maybe there's a logical mistake there.

Author:  krishon [ Sat Nov 23, 2002 6:55 pm ]
Post subject: 

i'm pretty sure it is not related to the loops, cuz i have like 9 of them. I may still have some problems to ask you, but i need my program to start working first, lol. Maybe i should send my file to u so that u can suggest what i should do. But it only works in turing 4.04b, and i dunno if u want the bmp's and the mp3.

Author:  Tony [ Sat Nov 23, 2002 8:58 pm ]
Post subject: 

don't have 4.04 nor will I get it...

If you've got many loops, make sure you indent properly. If you screw up with endings of loops, you might get in shit.

Author:  krishon [ Sat Nov 23, 2002 11:07 pm ]
Post subject: 

#####

Edited by Tony

Don't post stuff like that over here plz.

and I wouldn't want it ether... I got my reasons

Author:  krishon [ Sun Nov 24, 2002 12:44 am ]
Post subject: 

k, sry

Author:  krishon [ Mon Nov 25, 2002 10:07 pm ]
Post subject: 

Another problem. It used to work before, but when i asked it to exit when ........., it wuz supposed to go to a menu. however, it went somewhere else. Wut can i do to fix it??

Author:  Tony [ Mon Nov 25, 2002 10:11 pm ]
Post subject: 

if you put exit when inside a netsted loop, it will exit only that single loop. That might cause a problem.

here's an alternative solution if thats the case:

code:
var flag:boolean := false

loop
loop
if ExitCondition then
flag := true
exit
end if
end loop

if flag = true then
exit
end if
end loop


basically you set up a flag boolean variable to keep track of when you need to exit

Author:  krishon [ Mon Nov 25, 2002 10:17 pm ]
Post subject: 

i get it, but i found out i added an extra loop,lol. But thanx for the advice. You've really helped me. I really appreciate it.

Author:  krishon [ Mon Nov 25, 2002 10:28 pm ]
Post subject: 

oh and one more thing. I saw the little message about the saving the variables. However, it wuz pretty confusing and it didn't really work. Could u help explain it??

Author:  Tony [ Tue Nov 26, 2002 8:20 pm ]
Post subject: 

what do you mean saving variables? Like assigning new value as in

variable := newValue or to external file? In that case check out a tutorial on I/O in tutorial section.

If its none of above, please specify your question.

Author:  krishon [ Tue Nov 26, 2002 9:10 pm ]
Post subject: 

actually, nm bout it, i got it to work Wink

but i have another problem. I want to make a character in a game grow a level after it gets a certain number of experience points. How can i make it do that?? I've tried several things like dividing the number of experience points by a certain number and see if it was an integer. However, they did not work. Confused Wut should i do??????????????

thx, kris

Author:  Dan [ Tue Nov 26, 2002 10:31 pm ]
Post subject:  hummm

there are server things you coude do for this, the eisted whode to make a txt file with like 100 numse wich will repersent the number of ex points needed to lvl up for each level and have the prgame read the file. the progblem with thiss is that it can get repetive and you may whot to have your person be able to lvl up as much as they whont.

a nother sugestion is to use the flowing code, althoght this may not wrok right all the time it is able to some times cover a rela num to an int.

code:

var rnum : real := 5 div 2
var inum : int
var snum : string

snum := realstr (rnum,1)
inum := strint (snum,10)

put inum


this coude shode rownd the number up if itis not a wole number but becucale using it.

the onlyother way i can think of making an real to an int whode be using some completed code and the cheat fuction wich few poeopl know about, but becuse if you us it wrong you can mess over a lot of stuff i will not get in to that.

hope that helps.

Author:  krishon [ Tue Nov 26, 2002 11:47 pm ]
Post subject: 

could u sorta write a small code as example for the first one, cuz i'm a bit confused. The other two won't work cuz the one u put the code for rounds the number up, which i dun't want it to do. I'll only add a level once it reaches an int. No .1 higher or lower. Just at the interger. The second one i'm probably not gonna try since u said it might screw me up. I'll take ur word for it since ur more experienced than i am. But thx for the help. Very Happy

Author:  Tony [ Wed Nov 27, 2002 12:24 am ]
Post subject: 

well here's how I would have done it:

code:
var currentExp: int :=0 %experience of char
var lvlExp: int :=100 %experience needed to lvl

if currentExp >= lvlExp then
charLVL = charLVL + 1 %grow 1 level
currentExp:= currentExp - lvlExp %set experience to 0 + remainder
lvlExp := lvlExp * 2 %increase experience amount needed to level again
end if


so based on this code, your character will level at experience:
100
200
400
800
1600
...

as they do in most of the games. You can change that to w/e other number you want... If you wanna multiply by a decimal, you got to convert real to int. (Round/Ceil/Floor)

Author:  krishon [ Wed Nov 27, 2002 12:27 am ]
Post subject: 

k, that makes much more sense. Thx Very Happy

Author:  Tony [ Wed Nov 27, 2002 12:32 am ]
Post subject: 

no problem, good luck on your game Very Happy

Author:  krishon [ Wed Nov 27, 2002 1:08 am ]
Post subject: 

another problem. i have two different characters that the user can choose from. If i type in the other character, it exits all the loops of the character which i did not type, but it did not proceed to the code following the character which i chose. y is this happenin?? Confused

Author:  Tony [ Wed Nov 27, 2002 1:16 am ]
Post subject: 

i donno? flags? bad character set up?

here's how it should be:
code:

if character = "tony" then
name:= "tony"
strength:=100
intelegence:=1000
picture:="tony.jpg"
%other character starts
else
name:="dan"
strength:=99
intelegence:=999
picture:="dan.gif"
%other stats
end if


This way you have same loops for the characters, the only differences are starts, apperance, etc. If you have a poorly organized huge program with many loops, you will always experience problems when additing additional conditions for loop execution.

Author:  Dan [ Wed Nov 27, 2002 8:43 pm ]
Post subject: 

tony wrote:

code:

if character = "tony" then
name:= "tony"
strength:=100
intelegence:=1000
picture:="tony.jpg"
%other character starts
else
name:="dan"
strength:=99
intelegence:=999
picture:="dan.gif"
%other stats
end if



Oh i only get 999 intelegenc Sad , i see so thats how it is. JK Wink

any way it whode help if you post your code becuse there coude be thorsends of difrent things wrong

Author:  Tony [ Wed Nov 27, 2002 8:48 pm ]
Post subject: 

Hacker Dan wrote:

Oh i only get 999 intelegenc Sad , i see so thats how it is. JK Wink


ya... well it should be less, as I got 100+ posts and you got... not as much Wink

Author:  krishon [ Wed Nov 27, 2002 8:50 pm ]
Post subject: 

i could post my code, but its 1000 lines long. i dunno if it'll have enough space for it

Author:  Tony [ Wed Nov 27, 2002 11:56 pm ]
Post subject: 

ya, I don't think you should post... cuz someone else might take it... I know that there're some very bad people out there... Crying or Very sad

besides, I'm not going to look through 1000 lines for someone's typo.

a little sujestion: Printing out your code and properly indenting it... linking all the loops, ifs, etc to see better. Then just go through it. Looking at a printed version often makes a difference and mistakes are found easier.

|-For i:1..10
|~~~|-If i=1 then
|~~~| put "moo"
|~~~|-End if
|-End For

Do something like that... well No "~"s, its just that this forum removes all the extra spaces Confused

Author:  krishon [ Thu Nov 28, 2002 12:11 am ]
Post subject: 

k, i'll give it a try. But this question is for dan since he told ted livingston how to save variables and load them. How can make the game continue after i load the variables. For example, i save a game. When i come back to load the game, i need it to go directly where it left off. How can i do that???

Author:  Dan [ Thu Nov 28, 2002 1:39 am ]
Post subject:  la la la

well i am not shure what your game looks like but here are some qiuck tips. your game shode have a var for the x and y qorantes of the guy and if you have more then one map/screen you shode have a var that stores this data too. what you do is incopreat this data in to the save and load parts of your code. then when you load the saved that set those vars to the saves and refyrsh the screen if you got maps and stuff.

i am not shure but from the sownds of your other posted it sownds like you progame is all in loops i whode sugested making fuctions and or porgecers to keep your progame oragiesed.

my msn is dan@danpages.com if you take to me there i can send you the code for my rpg that delas witha lot of this. you may also whont to coseder haveing save points in the gam to cut down of the difrent amout of sopts where they can start. this will help stop some odd bugs you can get.

Author:  Dan [ Thu Nov 28, 2002 1:49 am ]
Post subject:  QFTB

i upload the code for my rpg and the map maker for my rpg to the server so you can now download them at:

QFTB code/pics/musik/vidoe - instaler

QFTB mapmaker with demo maps - code and pics


P.S. i turst that you will not steal the code but this is for other poleop, plz do not stael the code, i wroked very hread on this you can use pices and some of the fuctions and proges from it but plz give me credit in your code. thx. also if you got any code that uses parts of this game i whode like to see how you used them and i might upload them to this site if you whont.

Author:  krishon [ Thu Nov 28, 2002 11:35 am ]
Post subject: 

no. I won't steal it. I worked for like 10 hours on my thing. I'm not gonna waste 10 hours just to copy ur program. Very Happy

Author:  krishon [ Thu Nov 28, 2002 11:54 am ]
Post subject: 

i have an idea, you can make it a read-only file so that no one can change it.

Author:  Tony [ Thu Nov 28, 2002 6:41 pm ]
Post subject: 

doesn't matter... you can always just go to file properties and change it back...

here's an idea for dan: take screenshots and save them as low resolution gifs or png (some low size image file).

This way people can see the code, but to copy they'd have to retype 100s of lines Wink

Author:  krishon [ Thu Nov 28, 2002 7:06 pm ]
Post subject: 

lol, good point

Author:  Dan [ Thu Nov 28, 2002 7:20 pm ]
Post subject:  hummm

thata good idea but the thing is i whont poleop to be able to copey parts of it as long as they give me credit. i wroked for days on it but it is turing and i dont think it will compile so it is not much good other then school porgects. also there are some major bugs in it that i never fixed in this verison.

well thx for your cosere any way, and good luck with your game.

Author:  krishon [ Thu Nov 28, 2002 7:48 pm ]
Post subject: 

it dusn't run for some reason

Author:  krishon [ Thu Nov 28, 2002 7:58 pm ]
Post subject: 

dan, maybe i could send u my game so that u can do the variable thing for me. It loads, but it doesnot go directly to the play screen. Ted told me about putting the end if right before the menu, but it screws up the program. Evil or Very Mad

Author:  krishon [ Thu Nov 28, 2002 8:09 pm ]
Post subject: 

and one last thing, sry. It keeps on saying "I/O attemped on unopened stream number -10. Open failed with message........."

wut the hell do i do Confused

Author:  Tony [ Thu Nov 28, 2002 10:15 pm ]
Post subject: 

"I/O attempt"... well first you have to open the file before you can access it. Or maybe it failed to open the file.

Should be something like this:

code:
if StreamNum <1 then
%there was an error during attempt to open the file so
quit
end if



About going to sertain part of code... Does turing have Labels? As in
code:
GoTo SomePlace


I know VB has this feature and you can jump to any part of the code with them.

Author:  krishon [ Fri Nov 29, 2002 12:57 am ]
Post subject: 

about the goto thing, i think it may be tell and seek. I'm not too sure.

Author:  Tony [ Fri Nov 29, 2002 1:22 am ]
Post subject: 

a friend of mine (beyond expert in turing... aka Martin) says there's no GoTo Label in turing.

Personally I saw this feature only in VB and TI83Basic.

Author:  krishon [ Fri Nov 29, 2002 1:26 am ]
Post subject: 

k, afta i looked at my file, i found the file with i loaded and saved had different names, so i made them the same. Now it says "Attempt to read past eof" how do i fixit? Confused

Author:  krishon [ Fri Nov 29, 2002 1:45 am ]
Post subject: 

Very Happy Very Happy I got my other character to work Very Happy Very Happy

i just used case labels, and voila, it worked perfectly. So that problem is cleared. The only problem now was mentioned in the above post, about the eof.

Author:  Tony [ Fri Nov 29, 2002 1:57 am ]
Post subject: 

EOF means End Of File...

basically you're trying to read information from the file, but you're at the very end already.

So you ether read as much as you know is inside... or do this:

code:

loop
exit when eof
get: StreamNum, variable
end loop


The loop exits as soon as you read everything from it.

Here's a diagram

BOF < start of file
Data
Data < you suppost to read Data only
Data
EOF < end of file

Author:  Dan [ Fri Nov 29, 2002 3:12 am ]
Post subject:  e-mail

well it looks like you sorted out your probelem with tony but if you got another one and you whont to send us the code with out poleop copying it you can send it to our e-mail. our e-mails shude be in our porfiles.

Author:  krishon [ Fri Nov 29, 2002 5:55 pm ]
Post subject: 

dan, can i send u my game. I just need you to help me go to the player's menu right after the game is loaded. I'll just send u the turing file. There's no need for the pictures and stuff. After your done, u can send it back to my email. Just tell me here in the forum if u want me to send my game. There'z no reason to send it if ur not gonna look at it

Author:  krishon [ Fri Nov 29, 2002 6:42 pm ]
Post subject: 

acutally, nm, could i just put a procedure?? But then how would i put the procedure in the right spot so that it loads then it plays.

Author:  Tony [ Fri Nov 29, 2002 7:30 pm ]
Post subject: 

well come on... WinOOT is half-ass Object Oriented... Use that... Procedures, Functions, Classes, etc...

If your program is just one single procedure... well thats not right.

You can try using LOOPs insdtead of GoTo Label... something like this:

loop
exit if flag
...
exit
end loop

loop2
exit if flag
...
exit
end loop2

Basically if you put exit right in front of end loop, it will never loop, but it will become a piece of code that you can skip by setting your flag variable. Maybe you can use that to skip right to the part of the code you need.

Author:  krishon [ Fri Nov 29, 2002 7:38 pm ]
Post subject: 

of course my thing isn't one procedure, that would be so stupid:lol:. I wuz just refering to the saving variables part. But that dusn't matta now, i'll give ur idea a try

Author:  krishon [ Sat Nov 30, 2002 12:20 am ]
Post subject: 

dan, ur rpg keeps on having a problem. On line 57 it says illegal pic identifier. ur game seems really interesting. I've finished mine now, but i want to test urs out. How can u fix it?

Author:  Dan [ Sat Nov 30, 2002 1:48 am ]
Post subject: 

this coude be for a few reasonse, it was made for turing 3.1.1 so if you got thay us it in there. also try resting turing i coude be a sprit bug turing 3.1.1. in ation to these make shure all the files where installed.

as for you progame i dont know if you still got a go to labe in your pogame but from my experice goto is a very very very very bad thing to use in a progame. i have done serverl colage cores and some of the first things they tell you for alsomt any lagnuge that has somting like goto is DO NOT USE IT. even my old high school teacher was angested it.

i wil doble check my progame and see whats with that line

Author:  Tony [ Sat Nov 30, 2002 1:55 am ]
Post subject: 

did they give you any reason for NOT using GoTo ? I mean if its available, then its there for a reason.

Author:  Dan [ Sat Nov 30, 2002 1:58 am ]
Post subject:  humm

ok, i just looked at line 57 and here are some ideas,

1. make shure the file key.bmp is in the main qftb dir

2. make shure you are only runing the main.t file

3. some times in turing 3.1.1 when you close the dir brower it will not load pics right.

4. try install the filesto c:\qftb\

5. try resting oot and runing it befor anything eltes


also is this line 57 of mian.t or a difrent file and dose it show anything or dose it just come up with the error?

if you get it ruing i whode like to know your opione on it, it was my 11st rpg in turing and my 1st big turing potgect.

Author:  Dan [ Sat Nov 30, 2002 2:07 am ]
Post subject: 

to tonys re:

they side stuff ranging from it was bad from, it is more truble then it is good, it is a bad habit, almost all progames shode use a kind of loop and/or fuction or prosget to repate stuff.

i only relay keeped on aking when my high school teacher siade it and she did not know anthing so she coude not tell me much more then what she was tolad.

i think it is for servaer reason:

1. it showsbad form in your progaming skills (you relay shode not need one)

2. it can mess your prgame up if used wrong or even when you think you are using it right. (make messed up loops, run wrong things, ect)

3. some times in lauges there are a lot of fuction names and stuff that you may call using goto wich whode be bad.

4. you losse marks if it is for school

well thats all i can think of now, you are right in that it is there for areasion but i think it is very rare. for poleop that are new to progaming in any lauge it is just safe to say dont use it.

Author:  Tony [ Sat Nov 30, 2002 2:22 am ]
Post subject: 

Confused ok...

Personally I use it often for ErrorHandling. You actually LOSE marks if you DON"T use it.

Thats the only thing it should really be used for... Otherwise since I'm doing Object Oriented programming, I got tons of SUBs that are usually very small in size with no space for GoTo's.

Author:  krishon [ Sat Nov 30, 2002 11:56 am ]
Post subject: 

yah.....i found another way to go to the program, but it took a long time. I just copied and pasted the code. It works well, just that there is a longer delay time than usual, y?

Author:  krishon [ Sat Nov 30, 2002 12:07 pm ]
Post subject: 

oh yeah, its line 57 of the main.t. It shows a white background and then the message pops up

Author:  krishon [ Sat Nov 30, 2002 12:18 pm ]
Post subject: 

I dun't thinkt he key.bmp if in the main directory. where is it???

Author:  krishon [ Sat Nov 30, 2002 12:30 pm ]
Post subject: 

they're still problems with sprites

Author:  Dan [ Sat Nov 30, 2002 12:58 pm ]
Post subject:  la la la

hummm, very odd. you cude try resinaling it to see if the key.bmp file will install.

take to me onmsn about it if you still can get it to wrok.

Author:  krishon [ Sat Nov 30, 2002 1:19 pm ]
Post subject: 

k, now it works, cool game, but HOW DO I GET OUTA TOWN!!!!!

Author:  krishon [ Sat Nov 30, 2002 1:30 pm ]
Post subject: 

a problem is occuring. I saved the game. When i went back to the game, there wuz a message from one of the rpg files. wuts wrong?

Author:  Dan [ Sat Nov 30, 2002 6:38 pm ]
Post subject:  hummm bugy

well as i side the game is very bugy for a lot of reasons, partly my flaute for messing up the title sytem and a big part the turing cant hadle it becuse it uses a lot of pics and stuff all at the same time.

the save thing needs some wrok in the game, i never relay perfted it becuse it was a year end thing for school and i stoped when i got it marked. there could be a nother file missing or sotming.

to get out of two keep going right then down then rihgt.

the game was never finshed so it is not that longe after you get out of town.

aculey i have only had it run persitice with no bugs a few times, this is becuse turing slowly will die becuse of the grapicks and some dum bugs on my part.

w/e how your game going?

Author:  Dan [ Sat Nov 30, 2002 6:43 pm ]
Post subject:  humm

also if you cant figer out how to fixe the save progmel you can just try to set the save file back to what it was when you instaled it.

it shode look like this:

data.save:
code:

20 20 1 0 0 0 1 0 1
0 0 0 0 0 0 0 0 0 0


this shode also tell you how to hack the game so you can have tones of hp, ect.

also i whode not remoned copying the sytem for lvl up in this game buces affter a few lvls it get relay unblacned.

well what can i say, it is just a beat test of a demo for the game i was planing on making in c/c++

Author:  Tony [ Sat Nov 30, 2002 8:43 pm ]
Post subject: 

To Dan (and others interested in RPG creation):

I'd recommend making an RPG in VB. First of all, its object oriented with lots of usefull features like Control Arrays. Most importanly, DataBase Access made easy.

Turing RPGs don't work out mostly because of amount of informaiton that's being loaded and very poor organization. A solid DataBase solves that problem.

You can write your own DLLs in C/C++ and import then into VB to have fast functions. Also VB has a much better graphics controls then C/C++ (unless you're using DirectX, where C++ has more power).

Good luck

Author:  krishon [ Sat Nov 30, 2002 11:29 pm ]
Post subject: 

now that my game is done and bug free so far, i'm deciding to make some sort of weapons shop. How could i make it so that it displays what item i have and how can i add it to my damage. A little example with code can help.

Author:  Tony [ Sun Dec 01, 2002 12:07 am ]
Post subject: 

i guess that depends on how you got it set up... I guess the easiest way is like this:

code:

var weaponname : string
var weapondamage : int

procedure WeaponShop
put "You have ", weaponname, " that does ", weapondamage, " damage"
put "You can buy:"
put "1. Small Sword: 10 Dmg"
put "2. Large Sword: 15 Dmg"
put "3. Quit"
get answer

if answer = 1 then
     cash:= cash - weaponprice(answer) %money handling
     weaponname := "Small Sword"
     weapondamage := 10
elsif
...
end if

put "Thx for shopping, come again"

end WeaponShop

Author:  krishon [ Sun Dec 01, 2002 12:20 am ]
Post subject: 

so, if i want to make the shop appear i would put it in an if statement right??

Author:  krishon [ Sun Dec 01, 2002 12:21 am ]
Post subject: 

that is after a certain number of kills

Author:  Tony [ Sun Dec 01, 2002 12:43 am ]
Post subject: 

well usually weapon shops appear in towns.. but i guess it can be any condition. So

code:

if CONDITION %came into town for example
then
Call WeaponShop
end if

Author:  krishon [ Sun Dec 01, 2002 12:55 am ]
Post subject: 

the only problem is that my rpg doesn't have moving characters. I saw Dan's rpg, which was very buggy (sry if this offends u Dan). So mines is just a menu wit the pics. So i wuz just thinking of like being able to access a shop after a certain number of kills.

Author:  Tony [ Sun Dec 01, 2002 2:14 pm ]
Post subject: 

Some people still play in MUGs (Multi User Dungeon) which are entirely text based. You move from room to room and each room has different options available. You can have weapon shop one of them so it can be accessed by a text menu in sertain "rooms"

Author:  Dan [ Sun Dec 01, 2002 7:01 pm ]
Post subject:  la la la

no ofetes take about the bug comanet, as tony side thats the problem with rpgs in turing that have moviing guys and stuff. some times turing just cant take all the carp that you need to load.

well good luck with your rpg, may be you coude post it on the web or at least the exe file so others can take a look at it. Smile

Author:  krishon [ Mon Dec 02, 2002 1:23 pm ]
Post subject: 

my friend wants to know how to make buttons. Could u post the code for it here. It would be great, thx Very Happy

Author:  Dan [ Mon Dec 02, 2002 8:07 pm ]
Post subject:  gui

this is part of the gui fuctions in turing 3.1.1 (dont know about them in other virsosn).

1st at the very beging of your progame you need to load the gui modual.

code:

import GUI in "%oot/lib/GUI"


this is the full code for the buttion:

code:

import GUI in "%oot/lib/GUI"

var bt1: int %var for buttion

procedure btrun
%code that runs when bution is hit gose here
end btrun

%bution code
bt1 := GUI.CreateButtonFull (maxx div 2, maxy div 2, 0, "OK", btrun, 0, '^b', false)

%loop to keep the buttion wating for some one to hit it
loop
       exit when GUI.ProcessEvent
end loop


ok this is how it wroks, the buttion needs an int and a procedure to run when it is hit. it also needs a loop to keep it procsoing the gui.

this is how the buttion code wroks

intforbuttion := GUI.CreateButtonFull (x quredent, y quroedent, length of buttion, buttion text, name of procdure, hitght of buttion, short key, false)

also if you put 0 for leghut or high of buttion it will aotouset it.

one more thing dont use it with full screen it will not wrok right

Author:  krishon [ Sat Dec 07, 2002 12:31 pm ]
Post subject: 

another problem. I buy a weapon, but it bypasses allt he code for some reason. It subtracts the money but it does not say that i have the weapon! How can i fix it, i'll paste the code here:

code:
if weaponamazon = 1 then
                        moneyamazon := moneyamazon - 10000
                        if itemuseamazon = 1 then
                            put "You already have this weapon!"
                            moneyamazon := moneyamazon + 10000
                            delay (2000)
                            cls
                        elsif moneyamazon - 10000 >= 0 then
                            itemuseamazon := 1
                            put "You have bought the Eaglehorn Crusader Bow for $10000"
                            put "Your remaining funds is ", moneyamazon, "."
                            maxdamageamazon := maxdamageamazon + 50
                            mindamageamazon := mindamageamazon + 20
                            put "Your maximum damage is now ", maxdamageamazon, "."
                            put "Your minimum damage is now ", mindamageamazon, "."
                            delay (2000)
                            cls
                        elsif moneyamazon - 10000 < 0 then
                            moneyamazon := moneyamazon + 10000
                            put "You do not have enough money!!"
                            delay (2000)
                            cls
                        end if
                    elsif weaponamazon = 2 then
                        moneyamazon := moneyamazon - 15000
                        if itemuseamazon = 2 then
                            put "You already have this weapon!"
                            moneyamazon := moneyamazon + 15000
                            delay (2000)
                            cls
                        elsif moneyamazon >= 0 then
                            itemuseamazon := 2
                            put "You have bought Lycander's Aim Ceremonial Bow"
                            put "Your remaining funds is ", moneyamazon, "."
                            maxdamageamazon := maxdamageamazon + 60
                            mindamageamazon := mindamageamazon + 40
                            put "Your maximum damage is now ", maxdamageamazon, "."
                            put "Your minimum damage is now ", mindamageamazon, "."
                            delay (2000)
                            cls
                        elsif moneyamazon < 0 then
                            put "You do not have enough money!!"
                            delay (2000)
                            cls
                        end if
                    end if

Author:  krishon [ Sat Dec 07, 2002 12:32 pm ]
Post subject: 

sry about the alignment, it's a bit bad. also, a reply today would be very appreciated. thx

Author:  Dan [ Sat Dec 07, 2002 1:44 pm ]
Post subject:  hummm

i tested out your code by taking the code you have there andadding vars and it wroked fine. so i think the problem may be in a difrent part of your code. i whode sugeste look trow the code for the times when you use the var itemuseamazon and make shure you do not have a loop or somting that sets it back to 0 or somting.

Author:  krishon [ Sat Dec 07, 2002 2:01 pm ]
Post subject: 

could i just send u the code, cuz i looked ova it several times and i still cannot fix it.

Author:  krishon [ Sat Dec 07, 2002 5:43 pm ]
Post subject: 

tony or dan, how can i calibrate the slider thing made from the GUI. I found the code for the slider but i dun't know how control the volume.

Author:  Tony [ Sat Dec 07, 2002 6:16 pm ]
Post subject: 

code:

import GUI in "%/oot/lib/GUI"

var slider : int

procedure SliderMoved(value:int)
locate(2,1)
put "Horizontal Slider:",value
end SliderMoved

slider:= GUI.CreateHorizontalSlider(10,10,250,50,150,50,SliderMoved)

loop
    exit when GUI.ProcessEvent
end loop


Here's the working code

GUI.CreateHorizontalSlider(x,y,length,min,max,start, PROCEDURE)

the value of slider is passed on to the procedure SliderMoved and can be stored and/or displayed in there.

Author:  krishon [ Sat Dec 07, 2002 7:05 pm ]
Post subject: 

i didn't phrase my question right, i'm sorry. I meant to say i already drew the slider, but i do not know how to use the slider to control the actual volume of the computer. My friend mentioned about calibrating the slider to the volume of the computer, but he does not know how to do it.

Author:  krishon [ Sat Dec 07, 2002 9:40 pm ]
Post subject: 

could someone reply today or 2moro, cuz this is due on wednesday, thx Very Happy

Author:  Tony [ Sat Dec 07, 2002 10:07 pm ]
Post subject: 

ya, well basically you obtain the value of the slider and the set volume level to that value.

The problem is, you can't do that in turing, as you need access to sound-card hardware and turing can't do that.

You can include some dlls for that in C++ and perhard reference them in VB as well if you need to do that.


: