how to set the number of objects in stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 3
- Joined: Sat Jul 24, 2010 1:23 pm
how to set the number of objects in stack
hi guys,,
i m working on one appliction in which i am using different trucks for hearvesting purpose,
i am trying to set the number of trucks so that when the specified number are created then it must stop and display one window box to inform .
my code is given below please help me how to set the number trucks rather then repeat to the number of controls of this card.
global gSimulating
on mouseUp
put "java JRSocket 54322 10000" into tProcess
open process tProcess for neither
put ("localhost:54322") into tSocket
open socket tSocket
--If there is not a control "txttruck" then
if there is not a control "txttruck" then
answer "Please create a txtfield first!"
exit mouseUp
end if
write "Plant need trucks to collect items from field" & return to socket tSocket
write "plant : I need trucks to harvest 100 tons" & return to socket tSocket
write "Target is harvest" & return to socket tSocket
write field "txttruck" & return to socket tSocket
read from socket tSocket until return
put it into pResult
if pResult="movetruck"
then
if gSimulating is not "true"
then
put "true" into gSimulating
set the icon of me to 1038
--set the controls of this card to n
put field "txttruck" into f
if f>2*n
then
answer "stop process"
else
put n+1 into n and repeat until f>=1*2^n
repeat with x = 1 to the number of controls of this card
if the Kind of control x is "Truck" then
put true into sThereIsAtruck
if the Status of control x is not empty then send moveStopped to control x
if the Status of control x is empty then
wait 0.5 second
set the Status of control x to "Unloading"
set the DestinationID of control x to the ID of control "Plant 1"
move control x to the location of control "Plant 1" without waiting
end if
end if
end repeat
if sThereIsAtruck is not true
then
answer "You must have at least one Mobile Object to run a Simulation!"
put "false" into gSimulating
set the icon of me to 1040
exit mouseUp
end if
else
put "false" into gSimulating
set the icon of me to 1040
repeat with x = 1 to the number of controls of this card
if the Kind of control x is "Truck" then
stop moving control x
end if
end repeat
end if
send "upDateFieldNodeInfo" to group "Tree1"
if tSocket is among the lines of the openSockets then close socket tSocket
end if
end mouseUp
i m working on one appliction in which i am using different trucks for hearvesting purpose,
i am trying to set the number of trucks so that when the specified number are created then it must stop and display one window box to inform .
my code is given below please help me how to set the number trucks rather then repeat to the number of controls of this card.
global gSimulating
on mouseUp
put "java JRSocket 54322 10000" into tProcess
open process tProcess for neither
put ("localhost:54322") into tSocket
open socket tSocket
--If there is not a control "txttruck" then
if there is not a control "txttruck" then
answer "Please create a txtfield first!"
exit mouseUp
end if
write "Plant need trucks to collect items from field" & return to socket tSocket
write "plant : I need trucks to harvest 100 tons" & return to socket tSocket
write "Target is harvest" & return to socket tSocket
write field "txttruck" & return to socket tSocket
read from socket tSocket until return
put it into pResult
if pResult="movetruck"
then
if gSimulating is not "true"
then
put "true" into gSimulating
set the icon of me to 1038
--set the controls of this card to n
put field "txttruck" into f
if f>2*n
then
answer "stop process"
else
put n+1 into n and repeat until f>=1*2^n
repeat with x = 1 to the number of controls of this card
if the Kind of control x is "Truck" then
put true into sThereIsAtruck
if the Status of control x is not empty then send moveStopped to control x
if the Status of control x is empty then
wait 0.5 second
set the Status of control x to "Unloading"
set the DestinationID of control x to the ID of control "Plant 1"
move control x to the location of control "Plant 1" without waiting
end if
end if
end repeat
if sThereIsAtruck is not true
then
answer "You must have at least one Mobile Object to run a Simulation!"
put "false" into gSimulating
set the icon of me to 1040
exit mouseUp
end if
else
put "false" into gSimulating
set the icon of me to 1040
repeat with x = 1 to the number of controls of this card
if the Kind of control x is "Truck" then
stop moving control x
end if
end repeat
end if
send "upDateFieldNodeInfo" to group "Tree1"
if tSocket is among the lines of the openSockets then close socket tSocket
end if
end mouseUp
Re: how to set the number of objects in stack
irfan qasim ,
It is not clear what you want. Do you want to write a script that creates controls and stops creating as soon as the number of required controls has been reached or do you want to prevent the user from creating a new control when the number of allowd controls as been reached?
You probably want to execute the following line some time, but without additional information I can't say more about it.
Best regards,
Mark
It is not clear what you want. Do you want to write a script that creates controls and stops creating as soon as the number of required controls has been reached or do you want to prevent the user from creating a new control when the number of allowd controls as been reached?
You probably want to execute the following line some time, but without additional information I can't say more about it.
Code: Select all
if the number of controls is 234 then
beep
answer "Number of controls reached"
else
-- make additional controls here
end if
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 3
- Joined: Sat Jul 24, 2010 1:23 pm
Re: how to set the number of objects in stack
THANK U MARK FOR UPDATINGirfan qasim wrote:hi guys,,
i m working on one appliction in which i am using different trucks for hearvesting purpose,
i am trying to set the number of trucks so that when the specified number are created then it must stop and display one window box to inform .
my code is given below please help me how to set the number trucks rather then repeat to the number of controls of this card.
global gSimulating
on mouseUp
put "java JRSocket 54322 10000" into tProcess
open process tProcess for neither
put ("localhost:54322") into tSocket
open socket tSocket
--If there is not a control "txttruck" then
if there is not a control "txttruck" then
answer "Please create a txtfield first!"
exit mouseUp
end if
write "Plant need trucks to collect items from field" & return to socket tSocket
write "plant : I need trucks to harvest 100 tons" & return to socket tSocket
write "Target is harvest" & return to socket tSocket
write field "txttruck" & return to socket tSocket
read from socket tSocket until return
put it into pResult
if pResult="movetruck"
then
if gSimulating is not "true"
then
put "true" into gSimulating
set the icon of me to 1038
--set the controls of this card to n
put field "txttruck" into f
if f>2*n
then
answer "stop process"
else
put n+1 into n and repeat until f>=1*2^n
repeat with x = 1 to the number of controls of this card
if the Kind of control x is "Truck" then
put true into sThereIsAtruck
if the Status of control x is not empty then send moveStopped to control x
if the Status of control x is empty then
wait 0.5 second
set the Status of control x to "Unloading"
set the DestinationID of control x to the ID of control "Plant 1"
move control x to the location of control "Plant 1" without waiting
end if
end if
end repeat
if sThereIsAtruck is not true
then
answer "You must have at least one Mobile Object to run a Simulation!"
put "false" into gSimulating
set the icon of me to 1040
exit mouseUp
end if
else
put "false" into gSimulating
set the icon of me to 1040
repeat with x = 1 to the number of controls of this card
if the Kind of control x is "Truck" then
stop moving control x
end if
end repeat
end if
send "upDateFieldNodeInfo" to group "Tree1"
if tSocket is among the lines of the openSockets then close socket tSocket
end if
end mouseUp
ACTUALLY I M GOING TO DEFINED A NUMBER AND WHEN CONTROLS REACH AT THAT POINT THEN IT STOP CREATING MORE.
AS MY PROJECT 'repeat with x = 1 to the number of controls of this card' HERE I AM TRYING TO FIX THE NO. OF CONTROLS SO THAT WHEN THE REQUIRD NUMBER IS REACHED TEHN IT STOP.
HOPE FULLY YOU WILL UPDATE ME .
REGARD
IRFAN QASIM
Re: how to set the number of objects in stack
Dear irfan qasim ,
I'd be happy to help, but I don't know what you want.
Please, don't use all caps. It is considered rude.
Best,
Mark
I'd be happy to help, but I don't know what you want.
Please, don't use all caps. It is considered rude.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: how to set the number of objects in stack
dear Mark,,Mark wrote:Dear irfan qasim ,
I'd be happy to help, but I don't know what you want.
Please, don't use all caps. It is considered rude.
Best,
Mark
i am sending you all my project please run it and then tell me how to control the and sent the truck from plant to two fields.
actually i going to control and sent truck from plants to feild by own choice,. example ( if i have five total trucks and i sent two truck to field #01 and rest to other field) ,.....
Best Regard
irfan
Re: how to set the number of objects in stack
Hi Mark,,
i am trying to sent you my project so that you could understand and assist me to solve my problem.
but my project size is more than the allowed file 256 kb.
i will be thakful to you if you sent me ur personal contact id so that i could sent project file to you.
Best Regard
Irfan Qasim
i am trying to sent you my project so that you could understand and assist me to solve my problem.
but my project size is more than the allowed file 256 kb.
i will be thakful to you if you sent me ur personal contact id so that i could sent project file to you.
Best Regard
Irfan Qasim
Re: how to set the number of objects in stack
Irfan,
I don't have your contact info either. You can send me a message through the economy-x-talk website here. Once you have contacted me, you'll get an e-mail from me and will be able to send me your files.
Best regards,
Mark
I don't have your contact info either. You can send me a message through the economy-x-talk website here. Once you have contacted me, you'll get an e-mail from me and will be able to send me your files.
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
how option menue is used to select object
hi guys
i am using option menue in my application and want to select different value from it . my code is given below but now working.
i want to select on object from it and write it to socket ,..
code
write Menu "option" & return to socket tSocket
read from socket tSocket until return
put it into p1
if p1="c1" // here we have c1,c2,c3 are option menue and i select on
then
answer "okay"
end if
i am using option menue in my application and want to select different value from it . my code is given below but now working.
i want to select on object from it and write it to socket ,..
code
write Menu "option" & return to socket tSocket
read from socket tSocket until return
put it into p1
if p1="c1" // here we have c1,c2,c3 are option menue and i select on
then
answer "okay"
end if
Re: how option menue is used to select object
???irfan wrote:... my code is given below but now working...
Do you mean it is working NOW? Then what is your question? Or do you mean "...but NOT working"? I guess the latter.
The syntax for getting the currently selected option menu is: the label of btn "optinon menu button"
So you would like to:
...
put the label of btn "the option menu button" into tSelectedOption
write tSelectedOption & return to socket tSocket
...
Best
Klaus
Re: how to set the number of objects in stack
Dear Irfan,
I am a moderator and deleted your post in the section "Announcement" since it was a duplicate of your last question here!
And you posted it AFTER I gave my answer here!
So please make sure you read all answers before posting your question again and make sure to post it in the correct section.
Thanks!
Best from germany
Klaus
P.S.
Looks like you lack some basic thing in Rev, so I highly recommend to work through these wonderful stacks here:
http://www.runrev.com/developers/lesson ... nferences/
I am a moderator and deleted your post in the section "Announcement" since it was a duplicate of your last question here!
And you posted it AFTER I gave my answer here!
So please make sure you read all answers before posting your question again and make sure to post it in the correct section.
Thanks!
Best from germany
Klaus
P.S.
Looks like you lack some basic thing in Rev, so I highly recommend to work through these wonderful stacks here:
http://www.runrev.com/developers/lesson ... nferences/