Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Loading multiple images of similar names in an array
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JakeTakeLake




PostPosted: Sat Apr 13, 2013 2:56 pm   Post subject: Loading multiple images of similar names in an array

What is it you are trying to achieve?
I'm trying to load multiple images of similar names in an array.

Describe what you have tried to solve this problem
I tried using intstr(i) to convert the array number to a string. But, I'm having trouble adding it to the file location.
see code


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


var health : array 0 .. 15 of int
for i : 0..15
health(i) :=Pic.FileNew ("pics\\health\\health" , intstr(i) , ".bmp")
end for



Also, here's my working code that I'm trying to shorten.

Turing:

var health15 :int := Pic.FileNew ("pics\\health\\health15.bmp")
var health14 :int := Pic.FileNew ("pics\\health\\health14.bmp")
var health13 :int := Pic.FileNew ("pics\\health\\health13.bmp")
var health12 :int := Pic.FileNew ("pics\\health\\health12.bmp")
var health11 :int := Pic.FileNew ("pics\\health\\health11.bmp")
var health10 :int := Pic.FileNew ("pics\\health\\health10.bmp")
var health9 :int := Pic.FileNew ("pics\\health\\health9.bmp")
var health8 :int := Pic.FileNew ("pics\\health\\health8.bmp")
var health7 :int := Pic.FileNew ("pics\\health\\health7.bmp")
var health6 :int := Pic.FileNew ("pics\\health\\health6.bmp")
var health5 :int := Pic.FileNew ("pics\\health\\health5.bmp")
var health4 :int := Pic.FileNew ("pics\\health\\health4.bmp")
var health3 :int := Pic.FileNew ("pics\\health\\health3.bmp")
var health2 :int := Pic.FileNew ("pics\\health\\health2.bmp")
var health1 :int := Pic.FileNew ("pics\\health\\health1.bmp")
var health0 :int := Pic.FileNew ("pics\\health\\health0.bmp")


Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Sat Apr 13, 2013 3:06 pm   Post subject: RE:Loading multiple images of similar names in an array

Use + for string concatenation. It's only put that allows commas (and similar functions).
JakeTakeLake




PostPosted: Sat Apr 13, 2013 5:31 pm   Post subject: Re: RE:Loading multiple images of similar names in an array

DemonWasp @ Sat Apr 13, 2013 wrote:
Use + for string concatenation. It's only put that allows commas (and similar functions).


It works! Thanks!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: