Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Quick question! Need help!!!!!!

Author
Message
Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 27th Apr 2003 02:41
Ok this little snippet has been pulled from my game and modified.
It is supposed to PRINT:
0 e-1
1 e-2
2 e-3

But it doesn't do that at all! The only thing it gets right is 0 e-1.
This has been driving my crazy all day!! Is it something very simple that I'm missing? Please help! Thanks.

Code:
Slick
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location:
Posted: 27th Apr 2003 02:54
the do loop is the problem, if u only want to print the three values u might want to consider something like this

do
a=1
b=2
c=3
loop

u get the idea

or even

do
if a < 3 then
a=1+1
else goto label
loop
label close

Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 27th Apr 2003 05:01
Thanks for responding, but I don't think you understood what I was looking for. This snippet is part of my inventory system in my game. What I was trying to accomplish was not simply printing values. I put the print part in so that you could see that the variables aren't coming out correctly. These are the tohughts I have with the code displayed:


Line 3:order#=order#+1:effect(order#)=1RINT order#;" e-";effect(order#)

This is the only line that seems to be working. The order# variable is increased by one, making it 0. Then, effect(0) equals one. It is then told to print the order#, which is 0, and then effect(0), which is one. It does this correctly.


Line 4:order#=order#+1:effect(order#)=2RINT order#;" e-";effect(order#)
This line is a problem, though. I don't get why it doesn't work. This is my understanding of what the line should do:
order# is increased by one, making it 1. Then, effect(1) equals 2. Then it prints order#, which is 1, and effect(1), which is 2.

However, it does not think effect(1) is 2! It prints out something totaly different. The same problem occurs with line 5. The do loop was included simply because the code would not work without a loop. I just decided to put something random in the loop. I tried taking the a=1 out of the loop, but it still messes up.

This is really driving me nuts! Can you please explain to me what is going wrong? Thanks.
Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 27th Apr 2003 06:37
Yay I figured it out! Here's the updated version:



I changed the order# variable to o and the effect to Effect# and it somehow magically worked.
Slick
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location:
Posted: 27th Apr 2003 15:19
well done

Login to post a reply

Server time is: 2024-11-24 12:58:01
Your offset time is: 2024-11-24 12:58:01