Having problems today. Head throbbing. Check this code out.
The following code executes PERFECTLY. It does EVERYTHING I want it to do only it runs INCREDIBLY slow. Here is the code.
sync on : sync rate 60
do
if playerz#>3800 and playerx#< 3900
if playerx#>2750 and playerx#< 2900
if returnkey()=1 and obtainedknife#=0 `dialoglock=0 and obtainedknife#=0
dialogbox=1
time=0
obtainedknife#=1
endif
endif
endif
`show the message
`item_messagebox("Knife!",21,"Found a ")
item_messageboxstr("Knife!","You Found a ",15,16)
`get rid of the item that has been found
if obtainedknife#=1
hide object 13
knifegone#=1
endif
sync
loop
and the function
function item_messageboxstr(item$,msg$,obj1,obj2)
bool=0
while bool=0
if dialogbox=1
if returnkey()=0 then dialoglock=0
if object visible(obj1)<1 then show object obj1
if object visible(obj2)<1 then show object obj2
ink rgb(11,11,11),1
Text 243,265,msg$
ink rgb(192,0,0),1
Text 243+text width(msg$)+3,265,item$
`the incredibly SLOW part of the code
if time<8 then inc time,1
if returnkey()=1 and time=>8
dialogbox=0
time=0
endif
else
`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if object visible(obj1)>0 then hide object obj1
if object visible(obj2)>0 then hide object obj2
endif
bool=1
endwhile
endfunction item_messageboxstr
What this code does:
When I walk up the the knife, when I press ENTER a dialog box comes up and says "You have recieved a knife!" It doesnt check for the enter key being pressed while TIME <8, which prevents accidental double presses. When the user presses enter again, the message box dissapears.
Whenever the message box is on screen, the program goes incredibly slow. I think the function is being executed every loop, which slows things down. I want this to stop going so slow (by slow I mean 50 FPS to 20 FPS) and not delay the entire proggy (looks crappy when seagulls way down

)
Any help?
RPGamer
Current Project: Eternal Destiny
We need a texture artist!
If your interested email me -
[email protected]