Total players online: 6



Take the Tour | Site Map

It is currently Sat Oct 20, 2018 9:31 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: text to number
PostPosted: Thu May 17, 2018 3:08 am 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 172

Groups:
i am modifying kalocr.txt to read the Save Rewards Gump when doing bods
the easy part is done i can read the text on the gump and get the banked point value
so get a return text value of 0.200, 1.000 or 0.500 right now

so my question is how do i get the returned value into a number format that can be multiplied with ie the banked value of 0.200 * 50 = 10
right now when
%1 is 0.200 the result of the OCRtext read
Code:
  1. set !points %1 * 50

i getting answer of 0 instead of 10


Top
  Profile 
 Post subject: Re: text to number
PostPosted: Thu May 17, 2018 2:19 pm 
Offline
Adept Scripter
Adept Scripter

Joined: 09/13/2010 10:59
Posts: 172

Groups:
so here is the best i could come up with this is a test script

set %pointtext 12.200 ;this text would come from kalocr.txt result
str Pos %pointtext . ;
set %wn #STRRES - 1
set %wleft %wn -1
str Left %pointtext %wleft
set !points #STRRES * 50
set %wmid %wn + 2
str Mid %pointtext %wmid 2
set !points !points + #strres * 50 / 100


Top
  Profile 
 Post subject: Re: text to number
PostPosted: Sun May 20, 2018 11:57 am 
Offline
Script Scribe
Script Scribe

Joined: 04/14/2007 16:18
Posts: 97

Groups:
It looks like you are now breaking it out properly. Essentially there is no decimal match operations here. So you will need to adjust the numbers to be whole numbers. You can live with implied decimal places or put the decimal place back in if you need it for display purpses.


Top
  ProfileShow poster's scripts in the public script library 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Hosted by CalWeb Internet Services, Inc.