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 / Str$ and float variable upset

Author
Message
AyenTanth
9
Years of Service
User Offline
Joined: 15th Aug 2014
Location:
Posted: 15th Aug 2014 04:06
I have read several posts concerning decimals and float values. The only problem is the fact that when I try to decrease the decimal amount with str$(damage, 2) it comes up saying "Parameter for STR$ do not match 'Value' on line 67"

I don't understand how it works for everyone else but its fails for me.

Thank you
Lucas Tiridath
AGK Developer
15
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 15th Aug 2014 09:45
This usually means that the wrong type of data is being passed in. What data type is "damage"?

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 16th Aug 2014 00:10 Edited at: 16th Aug 2014 00:18
Quote: "The only problem is the fact that when I try to decrease the decimal amount with str$(damage, 2) it comes up saying "Parameter for STR$ do not match 'Value' on line 67""


I think the STR$ decimal feature is only good for a visual string output.
You'll want to decrease your actual damage variable instead, as in DEC damage,n

Also, make sure you do damage as FLOAT or just damage# so it's an actual float and not an integer.

666GO†O666
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Sep 2014 07:00
right, 'damage' is an integer by default, unless you defined a type like 'damage as float' when creating it). integers cannot have decimal places and this is probably causing the error.

str$(damage) should work fine and str$(damage#, 2) should also work fine.

Login to post a reply

Server time is: 2024-04-19 15:47:04
Your offset time is: 2024-04-19 15:47:04