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 / Scope of ENTRY()? - Really weird scenario.

Author
Message
Da_Rhyno
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 28th Sep 2011 04:07
I'm trying to make a text prompt that I'm using to get filenames, and for some odd reason it doesn't like the filenames I give it.
Now here's the kicker: I tried to recreate the problem by using the same function being called outside the routine it's usually called in, and it works fine.

Here's where it works:



But when I try it from this function, it doesn't work:


I'm actually stumped on this one. I don't know if this is a scope problem or what, as the first code example was outside a function and this is inside a function.

Any ideas?
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 28th Sep 2011 04:59
Cant test your codes, you're missing the array and type declaration. Do you mind adding those in? It will also help if you just post the codes you were testing out personally.

Aside from that, I do believe there are simpler approach to get this result. I'm unclear as to what you want it to be, all text based like command prompt or more graphical like windows based or something in the middle.

Da_Rhyno
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 28th Sep 2011 05:10
Here's the full code:


And all I'm trying to do is get a text form of input, which INPUT isn't playing nicely when I draw sprites. Attached is the editor template file needed for this.

Thanks...

Attachments

Login to view attachments
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 28th Sep 2011 05:26
Ahh I see what's going on, the problem itself is the INPUT statement. Write yourself a function to handle that process of typing in a string instead because the INPUT statement locks up your loop until you finish inputting.

Da_Rhyno
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 28th Sep 2011 05:35
Oh, sorry. Comment out those two inputs and uncomment the two lines before them:


Uncomment those. Those are the ones I posted about. I played with other parts of the code since I've posted this that needed file input.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Sep 2011 14:42
are adding the image type when you input the file name or is this being added.
eg
filename$ = Text_Prompt(0,0, "Enter filename: ")

I type hello you get

print filename == hello

or do you want
type hello

print filename$ == hello.png

if so added it to the string.

Dark Physics makes any hot drink go cold.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 1st Oct 2011 00:15
Try it this way (very crude):

Function TextPrompt(x, y, txt$)
DO
tmp$ = ENTR$(1)
TEXT x, y, txt$ + tmp$
rem Add any other stuff you wanna do
IF INKEY$() = CHR$(8)
rem I think bspace is 008??
rem restore your bg, refresh text
ENDIF
IF RETURNKEY() = 1
tmp$ = ENTRY$(1)
EXITFUNCTION tmp$
rem or EXIT if you need to do anything post-loop
ENDIF
LOOP
ENDFUNCTION tmp$

hope this helps some...

No matter how much you know, you'll always have far more left to learn... (My head hurts)

Login to post a reply

Server time is: 2024-11-24 02:02:22
Your offset time is: 2024-11-24 02:02:22