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
how to set the number of objects in stack
Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 3
- Joined: Sat Jul 24, 2010 1:23 pm
Return to “Getting Started with LiveCode - Complete Beginners”
Jump to
- LiveCode Community
- ↳ Announcements
- ↳ Developer Services Marketplace
- ↳ User Groups and Events
- ↳ SoCal LiveCode Group
- ↳ Greater Toronto Area LiveCode Users Group
- ↳ Off-Topic
- ↳ Made With LiveCode
- Getting Started With LiveCode
- ↳ Getting Started with LiveCode - Complete Beginners
- ↳ Getting Started with LiveCode - Experienced Developers
- ↳ Converting to LiveCode
- Developing With LiveCode
- ↳ Talking LiveCode
- ↳ Databases
- ↳ Games
- ↳ Internet
- ↳ Multimedia
- ↳ Software Engineering
- ↳ Version Control
- ↳ Feature Proposals
- ↳ Bug Triage
- Extending LiveCode
- ↳ Using Plugins for Customizing the LiveCode IDE
- ↳ Using Externals
- ↳ Making IDE Plugins
- ↳ Building Externals
- ↳ LiveCode Builder
- Platform Specific
- ↳ Windows
- ↳ Mac OS
- ↳ Linux
- ↳ iOS Deployment
- ↳ Android Deployment
- ↳ CGIs and the Server
- ↳ HTML5
- ↳ Raspberry Pi
- Academic Endeavors
- ↳ Teaching with LiveCode
- ↳ Research and Post Secondary
- ↳ LiveCode University
- ↳ Educational Outreach
- Livecode Open Source Archived Forum- closed to posting
- ↳ Engine Contributors
- ↳ IDE Contributors
- ↳ Documentation and Tutorials
- ↳ Brainstorms
- ↳ Community Projects
- LiveCode Hosting