Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 9:59 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Arrays
PostPosted: July 29th, 2011, 10:46 am 
Offline

Joined: July 5th, 2011, 2:51 pm
Posts: 44
Opus: Opus Pro 8
OS: Windows 10; 64-bit operating system
System: Intel(R) Core(TM) i5 CPU, 4.00GB (RAM)
Hi, I am trying to create an "array loop" so it goes like this:

i have my text box in which i am entering the names and i have an STORE button that stores the names i entered everytime I press it. Then i have my debug button that has the "array loop" on it.
It looks like this

Debug.trace(myArray[count]);
count = count ++;

on my script object i have my variables declared :

var myArray = new Array()
var count

on my STORE button i have this:

Debug.trace(nameEntered) ///nameEntered : store input information in this variable (on the textbox)
nameEntered = ""

now when i click on the DEBUG button it does absolutely nothing.. Any ideas?


For this message Animellarx has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Arrays
PostPosted: July 29th, 2011, 10:27 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
It seems that you have code in various places and that makes it difficult to assess what's wrong. It would be best if you zip the IMP file and post it as an attachment.

NOTE: Digital workshop keep moving your posts because scripting questions get asked in the this (advanced) section not the basic one :-)

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Animellarx


Top
 Profile Visit website  
 
 Post subject: Re: Arrays
PostPosted: July 31st, 2011, 10:17 pm 
Offline

Joined: July 5th, 2011, 2:51 pm
Posts: 44
Opus: Opus Pro 8
OS: Windows 10; 64-bit operating system
System: Intel(R) Core(TM) i5 CPU, 4.00GB (RAM)
I see sorry for that...I wil post on the advanced section then. Thank you


You do not have the required permissions to view the files attached to this post.


For this message Animellarx has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Arrays
PostPosted: August 1st, 2011, 5:32 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
There is actually nothing wrong with it.

However, there is no connection between the counter for the ADD and the DEBUG.

This means that if you enter 'house' and click add, then click debug it will show the value BUT if you click debug again it will look for an array element that has not been added.

Not sure what you're trying to achieve. If you simply want to show the ADDED value in the DEBUG pane, the put the code together and use a single variable:

ADD(i)
DEBUG(i)
i++

If you want to add a run of values and then DEBUG through the array, you need a conditional operator such as IF that prevents the DEBUG counter from passing the maximum value of the ADD counter.

ADD(i)
i++
ADD(i)
i++
ADD(i)

if p<i DEBUG(p)
p++
if p<i DEBUG (p)

But as I said above, it depends on what you're trying to do.

Mack

BTW, the variables in the script object do not need the 'var' keyword. This is used to scope a variable locally to a function.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 39 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 © 2000, 2002, 2005, 2007 phpBB Group