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.

DarkBASIC Professional Discussion / Possible bug using "entry$" to get some text

Author
Message
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Mar 2011 15:39
I'm having a couple of problems here.

Here is some example code:


The code does a simple shot of the current view with "test1" printed at the top. Then it uses my entry function which returns the expected value (even if it shows a zero after the entry$ text for some unknown reason...). Then when I try to use "get image" again I get an "unknown image" error from the "save image" command!

I'm at a loss!

Any help appreciated

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Mar 2011 15:44
One thing to watch for with text input, is unusual ascii creeping in there - for example, if you press return, that might register with a returnkey() check, but also with the entry$().

I tend to check to see if the entry$() is a single character, then make sure it's ascii is >31, and also move the clear entry buffer command to after the entry$()...

i$=entry$() : clear entry buffer
if len(i$)=1 and asc(i$)<32 then i$=""
t$=t$+i$

Last time I used this, the bugs dissapeared as soon as I added the <32 ascii check.

Health, Ammo, and bacon and eggs!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Mar 2011 15:58
Thanks VanB I'll give that a try right now!

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Mar 2011 16:15 Edited at: 10th Mar 2011 17:51
That sorted it thanks again!

Here's my "get input" function for anyone interested (using d3d plugin):


Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Mar 2011 17:30
Cool - must be some rogue ascii characters. I recently had a bloody horrible bug with it, entering a file name but just backspacing the original file name to change it - it was keeping all the extra backspace characters and so the file wouldn't save. I lost a good 20 levels for my game to that!

Health, Ammo, and bacon and eggs!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Mar 2011 17:35
Thanks again! I'm glad it wasn't just a mistake on my part because I couldn't see anything wrong with the code... mind you, sometimes it's hard to see problems in your code when you're hitting the monitor with your chair

Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 10th Mar 2011 17:47 Edited at: 10th Mar 2011 17:50
bax - this is neat, but it's not returning any value. I don't notice a value for e$. Shouldn't it return txt$?

Returning txt$ makes it work for me. Thanks for the code!

Also, it should be mentioned that this also uses IanM's matrix plugin.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Mar 2011 17:54
Quote: "bax - this is neat, but it's not returning any value. I don't notice a value for e$. Shouldn't it return txt$?

Returning txt$ makes it work for me. Thanks for the code!

Also, it should be mentioned that this also uses IanM's matrix plugin."

Fixed that in my code but not in the post thanks Rich! Missed the matrix command too!

I'm so used to IanM's commands I forget which are not native anymore! It's almost worth not telling people that those plugins are needed until they ask why it doesn't work. Gives you an opportunity to say "You HAVE to use this plugin. It's essential..."

Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 10th Mar 2011 17:59
So true, so true! Really there ought to be a big graphic at the top of every forum - "Hey, before you do ANYTHING, get IanM's plugins!"

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Mar 2011 18:05
TGC should just standardize them and add them to the default DBPro. Some of his commands are pretty vital these days, it's hard to distinguish sometimes (like Baxslash says). That, and Direct3D plugin which gives 3D text and nice, fast drawing commands.

Health, Ammo, and bacon and eggs!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Mar 2011 18:12
I don't think I've written a single game in the last two years that didn't use both...

Admiral MH
15
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 10th Mar 2011 18:31
Quote: "TGC should just standardize them and add them to the default DBPro. Some of his commands are pretty vital these days, it's hard to distinguish sometimes (like Baxslash says). That, and Direct3D plugin which gives 3D text and nice, fast drawing commands."


I agree. I have about 17 plugins and still adding more . They should standardize with the essential plugins. Without plugins, I don't think I can live without them while coding in DBPro .
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Mar 2011 18:49
I definitely agree that IanMs Matrix 1 Utilities Plugin should be included. Their vital to our everyday programming and any newbie that doesn't have it will never see Darkbasic Pros full potential.

Login to post a reply

Server time is: 2026-07-15 03:40:00
Your offset time is: 2026-07-15 03:40:00