Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 11th, 2007, 4:45 AM   #1
dpsleep
Newbie
 
Join Date: May 2006
Posts: 16
Rep Power: 0 dpsleep is on a distinguished road
compile a var name from another var

i have a script that holds the functions for a desklet. the desklet is to be ran in a program called avedesk. ultimately this block of code is meant to first check for the next side to flip to, then check if that side is enabled, then switch to it if it is, if its not, goto the next side and check it.

the variables of chk0-chk4 are ether true or false, true meaning the side is enabled false meaning it isn't and to skip it.

side is the current active side of the desklet

the newside stuff is just telling it if the current side is not the last side add one, else goto the first side.

then we got the while loop

now the problem im having is that im just starting js as this desklet program requires it. so i don't know much about the syntax and have been trying to get by on frequent Google searches.

the part im having trouble with is
if(newside == i && ("chk" + i) == 'true'){

what im trying to do is have the var i from the loop be added after chk so that if i == 2 it work read out to:
if(newside == i && ("ch" + i) == 'true'){
if(newside == i && chk2 == 'true'){

this is the best way i could come up with to get the reaction i want, i just don't know how to make the two add together.

function flipnext(){
	var chk0 = this.parameters('radarchk1');
	var chk1 = this.parameters('radarchk2');
	var chk2 = this.parameters('radarchk3');
	var chk3 = this.parameters('radarchk4');
	var chk4 = this.parameters('radarchk5');
	side = desklet.GetcurrentSide();
	if(side < 4){
		newside = side + 1
	}else{
		newside = 1
	}
	i = 0
	while(i < 5){
		if(newside == i && ("chk" + i) == 'true'){
			desklet.FlipTo(i);
			alert(i);
		}else if(("chk" + i) == 'false'){
			newside + 1
		}
	i++
	}
}

sorry if this has been solved before, i didn't know what to call it so i didn't really know what to search for. any help on this method or maybe an alternative method would be greatly appreciated. thanks.
dpsleep is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
please help me to compile cwl157 C++ 37 Mar 6th, 2006 6:12 PM
MASM32 compile problem Kilo Assembly 3 Nov 20th, 2005 12:39 PM
can't compile code lloydkirk Java 17 Oct 6th, 2005 2:07 AM
Fahrenheit / Celsius compile problem andrewgray C++ 20 Jul 8th, 2005 11:04 PM
C++ Compile gebreil C++ 6 May 29th, 2005 1:30 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:15 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC