Problem with timer in text code?

Blitz3D Forums/Blitz3D Programming/Problem with timer in text code?

Guy Fawkes(Posted 2011) [#1]
@ross, i'm having a bit of a problem. when it fades out, i FOR NOW want it to end the program after 1 second has passed after reading the message. HOWEVER, it doesnt activate the timer at all.

Here's my update_paragraph():



Thanks as usual! :)


Ross C(Posted 2011) [#2]
As I said in the other thread, you need to put the

timer = millisecs()


Into the part where the text stops displaying. so, as you said in the last post, the code that does that is this:

ElseIf rc_para\status = 3


So you'll need to put the timer = millisecs() code into the part where the status is being changed to rc_para\status = 3. Which, looking through your code is here:

				If rc_para\next_id = rc_para\id Then ; if there is no more paragraphs left then
			
					rc_para\status = 4		; PLACE BELOW THIS LINE. set to status to fade out.
					rc_para\fade_timer = MilliSecs()	; start the fade timer
					CopyRect 0,0,rc_window\pixel_width,rc_window\pixel_height,0,0,TextureBuffer(rc_window\master_text_texture),TextureBuffer(rc_window\text_texture)
				
				Else
					rc_para\ID = rc_para\next_ID ; set to the next paragraph.
					load_next_paragraph(rc_para.cur_paragraph)
					CopyRect 0,0,rc_window\pixel_width,rc_window\pixel_height,0,0,TextureBuffer(rc_window\master_text_texture),TextureBuffer(rc_window\text_texture)
					rc_para\x = rc_window\margin_x
					rc_para\y = rc_window\margin_y
					rc_para\timer = MilliSecs()
					rc_para\char = 0
				End If


That will set the timer running when the status is changed to 4, since there seems to be no status change to 3 anywhere in the code.

Last edited 2011


Guy Fawkes(Posted 2011) [#3]
I tried that and the timer started, but then it stopped, and it automatically closed at the end line, which shouldn't have happened.

Last edited 2011


Guy Fawkes(Posted 2011) [#4]
Here's my code:

main.bb:



code.bb:



The above is Function update_paragraph() inside code.bb.

EDIT 2: I had to put the timer code in my main loop as the update_paragraph only updates once per paragraph and does not keep resetting.

I got the timer to work, but now it won't activate what's in the If command, which is the word "End".

Last edited 2011


Guy Fawkes(Posted 2011) [#5]
P.S. Yes I DID global mytime and mytimer inside main.bb


Guy Fawkes(Posted 2011) [#6]
anyone? :/


Guy Fawkes(Posted 2011) [#7]
CRISIS OVERTED! =D FIXED!

I added a new status and waited for alpha to = 0

rc_para\status = 5

:P then i added my own timer command with an update function

and only updated after rc_para\status = 5 :P


Ross C(Posted 2011) [#8]
Glad you got it fixed man!


Guy Fawkes(Posted 2011) [#9]
im still having a bit of an issue. u see, i want it when i talk to a character the second time, to revert to a 2nd message and stay on that second message.

i also need for it to check and see if the end of the paragraph has been reached, if it has, set the timer for 30 seconds which is about 2 seconds in game time, and press enter automatically for u if the user hasnt already. if they have pressed enter, stop the timer from running and reset it.

i also need it so it detects if your close to a hidden pivot, in which case, auto start the story and do the above. :)

Last edited 2011


Guy Fawkes(Posted 2011) [#10]
which is why im releasing it :)