Flashing / cls / View.Update
Author |
Message |
TokenHerbz
|
Posted: Wed Sep 21, 2005 12:12 am Post subject: Flashing / cls / View.Update |
|
|
Hey, i got mass flashing happening with just words...
THis isn't the code, but heres the example
code: |
loop
cls
put "Health: ", player.Health
if Somthing then
player.health += 5
end if
View.Update
end loop
|
So somthing along the lines of that, Though i tryed many combinations of just CLS, just View.Update, Using both, In different spts aswell, And even trying to stop it with delays...
I can slow it with a delay, though then i cant do input, as the program stops, So, you can see im in a bit of a pickle, am i useing these wrong?
Please help, Thnaks |
|
|
|
|
|
Sponsor Sponsor
|
|
|
beard0
|
Posted: Wed Sep 21, 2005 6:55 am Post subject: (No subject) |
|
|
Have you used View.Set("offscreenonly")? It is necessary to do this before View.Update becomes effective. |
|
|
|
|
|
Flikerator
|
Posted: Wed Sep 21, 2005 8:23 am Post subject: (No subject) |
|
|
Beard0 is right. View.Update is useless without View.Set("offscreenonly")
You will just be updating it another time. Each time a line of code is run in turing it updates the screen. If you have offscreenonly on it will only update the screen when you tell it to using View.Update() or View.UpdateArea(). |
|
|
|
|
|
TokenHerbz
|
Posted: Wed Sep 21, 2005 7:58 pm Post subject: (No subject) |
|
|
Where do i add offscreenonly, and do i need the () After View.Update...
ALSO, Using getch, do i need Input.KeyDown??? To use the ARROW keys, etc? |
|
|
|
|
|
Cervantes
|
Posted: Wed Sep 21, 2005 8:29 pm Post subject: (No subject) |
|
|
tokenherbz wrote:
Where do i add offscreenonly, and do i need the () After View.Update...
ALSO, Using getch, do i need Input.KeyDown??? To use the ARROW keys, etc?
At the beginning, no, no, respectively.
To clarify the last question, it's best not to use getch and Input.KeyDown together. I was just discussing this in the usernames and password thread, although I really didn't do a good job. But nonetheless, you don't need Input.KeyDown to get arrow input:
code: |
var c : string (1)
loop
getch (c)
put c = KEY_RIGHT_ARROW
end loop
|
|
|
|
|
|
|
TokenHerbz
|
Posted: Thu Sep 22, 2005 3:15 am Post subject: (No subject) |
|
|
so how do i use it ?
code: |
var c : string (1)
loop
getch (c)
if c = KEY_RIGHT_ARROW then
x += 1
end if
end loop
|
Like so? does this work with Esc / A, the letters / numbers / Enter? Eveything on the keyboard? |
|
|
|
|
|
jamonathin
|
Posted: Thu Sep 22, 2005 9:05 am Post subject: (No subject) |
|
|
tokenherbz wrote:
Like so? does this work with Esc / A, the letters / numbers / Enter? Eveything on the keyboard?
That's like asking, "can i use variables to represent the x and y values of a circle?" Drrrrr...... Well why dont you try. The best way to learn is through trial and error.
Ever been told not to touch a hot stove, then touched it? Learn through experience. |
|
|
|
|
|
Cervantes
|
Posted: Thu Sep 22, 2005 3:20 pm Post subject: (No subject) |
|
|
jamonathin wrote:
Ever been told not to touch a hot stove, then touched it? Learn through experience.
For something like this, yes. For many other things, learn from other's experiences. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TokenHerbz
|
Posted: Thu Sep 22, 2005 8:42 pm Post subject: (No subject) |
|
|
Stupid getch, my program keeps saying, Waiting for input...
How do i use this correctly, i been trying to a while...
Im going to read more up on this, and hasch
mean while please help me a bit, these are very confusing...
Edit:::::
code: |
setscreen("Graphics:300;300")
View.Set("offscreenonly")
var x, y: int := 150
var c: string(1)
var s: int := 1
var co: int := 7
loop
cls
getch (c)
if c = KEY_RIGHT_ARROW then
x += 1
end if
if c = KEY_LEFT_ARROW then
x -= 1
end if
if c = KEY_UP_ARROW then
y += 1
end if
if c = KEY_DOWN_ARROW then
y -= 1
end if
if c = KEY_ENTER then
s += 1
end if
if c = KEY_SHIFT then
randint(co,1,100)
end if
if c = KEY_ESC then
exit
end if
drawfilloval(x,y,s,s,co)
View.Update
end loop
cls
put "you quit"
|
try that, i have a problem...
A) Top left, theres a black box which i do not want there, it seems to was input all the time
B) it seems slow...
C) It cant *Multi command* (though i wont need that with my RPG*) |
|
|
|
|
|
Cervantes
|
Posted: Fri Sep 23, 2005 9:59 am Post subject: (No subject) |
|
|
For this sort of thing, use Input.KeyDown. |
|
|
|
|
|
TokenHerbz
|
Posted: Fri Sep 23, 2005 4:25 pm Post subject: (No subject) |
|
|
alright, Then
Why is getch useful if i can just USE KeyDown?
What are the strengths of getch over keydown? |
|
|
|
|
|
Cervantes
|
Posted: Fri Sep 23, 2005 6:37 pm Post subject: (No subject) |
|
|
Getch is better for typing, or other things where only one key is pressed at a time and keys are generally not held for long.
Input.KeyDown is good for more complex input where multiple buttons may be held at the same time, and where a constant stream of boolean values on any specific key is required. (For example, we don't want to check if the right arrow is hit, we want to check if it is down.) |
|
|
|
|
|
TokenHerbz
|
Posted: Sat Sep 24, 2005 4:44 pm Post subject: (No subject) |
|
|
Alright, and it is bad to mix them?
Why is this? |
|
|
|
|
|
Cervantes
|
Posted: Sat Sep 24, 2005 6:10 pm Post subject: (No subject) |
|
|
This would be the third time this week I've been asked to explain that.
http://www.compsci.ca/v2/viewtopic.php?p=93573#93573.
I feel bad about that explaination. It's so terrible you might as well just take my word for it. The point I did try to get across in that little expose is to experiment for yourself to see why. |
|
|
|
|
|
|
|