
-----------------------------------
pozaj0206
Fri Sep 02, 2011 9:00 pm

geting an random intiger in a sentance and adding it to a variable
-----------------------------------
What is it you are trying to achieve?
I have a file the looks like...
biomeSize:1.5
minMoisture:0.0
maxMoisture:1.0
ECT.
I want to make turing open this file ad get the 1.5 in a variable ad the 0.0 in another 1 ect.


What is the problem you are having?
the 1.5 ad the 0.0 ad whatever else are variable they could be any number when the file is loaded.


Describe what you have tried to solve this problem
I dot know how to approach this problem.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
this is how it wrights to the file



procedure Save
    open : stream, "XXXXXXXXXXXXXXXXXXXX.ini", put
    %wrighting the settigs to the file%
    put : stream, ""
    put : stream, "biomeSize:", item1
    put : stream, "minMoisture:", item2
    put : stream, "maxMoisture:", item3



Please specify what version of Turing you are using
4.1

-----------------------------------
Insectoid
Fri Sep 02, 2011 9:57 pm

RE:geting an random intiger in a sentance and adding it to a variable
-----------------------------------
Do you absolutely have to include 'biomeSize' and 'minMoisture', etc in the input file? You could just have
1.5
0.0
1.0

in the input file and it'd work fine.

-----------------------------------
pozaj0206
Sat Sep 03, 2011 9:04 am

Re: RE:geting an random intiger in a sentance and adding it to a variable
-----------------------------------
Do you absolutely have to include 'biomeSize' and 'minMoisture', etc in the input file? You could just have
1.5
0.0
1.0

in the input file and it'd work fine.

yes I do because it is a config file for another program ad there is about 350 of these all with different names

-----------------------------------
Tony
Sat Sep 03, 2011 9:46 am

RE:geting an random intiger in a sentance and adding it to a variable
-----------------------------------
you can either read one character at a time, and figure things out as you go along, or read the entire line, find colon (with something like [tdoc]index[/tdoc]), and split the line into usable parts.

-----------------------------------
pozaj0206
Sat Sep 03, 2011 10:30 am

Re: RE:geting an random intiger in a sentance and adding it to a variable
-----------------------------------
you can either read one character at a time, and figure things out as you go along, or read the entire line, find colon (with something like 

Ok ill try that thx :)

-----------------------------------
pozaj0206
Sat Sep 03, 2011 10:55 am

Re: RE:geting an random intiger in a sentance and adding it to a variable
-----------------------------------
you can either read one character at a time, and figure things out as you go along, or read the entire line, find colon (with something like 

actually would there be a way for turing to like go to line 1 then right XXX times until it passes the colon the get the numbers and decimal until end of the config line?
(it doesn't matter to me if i have like 10 lines of code for every entry in the config file)

-----------------------------------
Insectoid
Sat Sep 03, 2011 11:34 am

RE:geting an random intiger in a sentance and adding it to a variable
-----------------------------------
it doesn't matter to me if i have like 10 lines of code for every entry in the config file

This is bad. Never say this again. You'll learn bad habits while you give yourself carpel tunnel from typing hundreds of thousands of lines for every program. 

You know what a function is, right? Write a function that takes a string as input and outputs an integer. This is probably the easiest way to do it.

-----------------------------------
pozaj0206
Sun Sep 04, 2011 12:08 am

Re: geting an random intiger in a sentance and adding it to a variable
-----------------------------------
Thanks Insectoid, i never thought about using a function. :)
ill post how it went later cuz Indiana Jones is on right now :p
+15 bits for you :p
