I want to get list card and list objects of stack by name.
Before.I ask question "How to find stack of Project Browser ? - livecode".I can do it.
Now.I want to get list card and list objects of stack by name.
Can anyone show example code for me please ?
Here my code for get number of cards of this stack
answer the number of cards of this stack
But my code this error for get name card
answer the name of cards of this stack
-------I can solve this problem-------
on mouseUp
put the number of cards of this stack into numC
repeat with crd = 1 to the number of cards of this stack
answer the name of card crd
end repeat
end mouseUp
Here's an example that creates an array with the stack card names as keys. Each array element contains a list of the controls for the card.
on mouseUp
local tCurrentStack, tCards, tCurrentCard, tControlsA
put "MyStack" into tCurrentStack
put the cardNames of stack tCurrentStack into tCards
repeat with tCardIndex = 1 to the number of lines in tCards
put line tCardIndex of tCards into tCurrentCard
repeat with tControlIndex = 1 to the number of controls in card tCurrentCard of stack tCurrentStack
put the name of control tControlIndex of card tCurrentCard of stack tCurrentStack & LF after tControlsA[tCurrentCard]
end repeat
end repeat
end mouseUp
to show the controls from card "MyCard"...
put tControlsA["MyCard"]
Related
So I'm doing a simple python game for a school project and it is like a playing card game. But i don't know how to remove the card I've played.
Basically, I have a pack of 7 cards and i randomly choose one card to be played if my attack > than opponents defese I won, and my card should not be used anymore. I'm doing all based on lists and strings, How can I remove the card who was randomly chosen?
baralho1=[]
baralho1 += random.sample(MasterList, 7)
print("\nEste é o teu baralho:\n",baralho1)
baralho2=[]
baralho2 += random.sample(MasterList, 7)
a=random.choice(baralho1)
How do I remove "a" from the "baralho1"?
How do I remove "a" from the "baralho1"?
baralho1.remove(a)
Please read the documentation on mutable sequence types.
I am trying to move a substack up on keyboardactivated using the following code
local lStackLoc,lStackSize
on openstack
set the fullscreenmode of me to "exactFit"
put the loc of this stack into lStackLoc
put the effective working screenRect into lStackSize
end openstack
----------------------
on keyboardactivated
put the effective working screenRect into tStackSize
set itemdel to comma
put item 4 of lStackSize - item 4 of tStackSize into tKeyboardHeight
put item 2 of lStackLoc - tKeyboardHeight into tNewLocY
put item 2 of lStackLoc & "," & tNewLocY into tStackLoc
move stack "mainsub" to tStackLoc
end keyboardactivated
----------------------
on keyboardDeactivated
move stack "mainsub" to lStackLoc
end keyboardDeactivated
The stack does not move. Have I missed something, is it possible to move a substack even it part of it will be off screen?
Is your application running on a mobile device, or on a desktop system?
If running on mobile, stacks always display using the rect of the screen, and you can only display one stack at a time. The fullscreenMode determines how the stack is sized relative to the screen's rect and how the stack's contents are displayed, but you can't move stacks around on a mobile screen.
I am using movingControls like this(1033 is in myID)
if myID is among the lines of the movingControls then beep
This is very similar to the example. When I encountered an issue I had livecode ask the moving Controls which returned this
image id 1033 of card 1002 of stack "C:/Users/Jeffrey/Desktop/Musyc.livecode"
If I am not mistaken 1033 is within this, then how come nothing happens. Please help
Nothing is happening because "is among the lines of..." compares entire lines of text. Your value "1033" doesn't match the string " image id 1033 of card 1002 of stack "C:/Users/Jeffrey/Desktop/Musyc.livecode" ".
Store the long id of your image in myID and you should get a true response (beep).
I have stored a stack in a custom property, using
set the cStack of stack "abc" to \
url "binfile:~/desktop.abc.rev"
This opens the stack:
go inv stack (the cStack of this stack)
The stack needs to be hidden. Due to the nature of the project, I can't know the name of the stack in advance, but I need to know its name to use it. I tried to use the openStacks, because I thought that the last opened stack would appear at the top of the list, but that doesn't work. I also tried the stacks but that doesn't even contain the name of the stack. The last stack causes an error.
How can I get the name of the most recently opened stack?
You could do the following:
put the openstacks into tOpenStacksBefore
go inv stack (the cStack of this stack)
repeat for each line tStack in the openStacks
if tStack is not among the lines of the openstacks then
exit repeat
end if
end repeat
-- tStack now contains the name of your stack
Basically you are:
Storing a list of open stacks before you open yours.
Repeating for each of the openstacks to find the one that wasn't in the list before you opened your stack.
Right after you open the stack, you can get the long id of this stack. That allows you to refer to it later.
go inv stack (the cStack of this stack)
put the result into rslt
if rslt is empty then put the long id of this stack into myStack
else put empty into myStack
// example
put fld 1 of myStack into myData
I want to delete stack with my button.
Here code:
delete stack stackname
Before delete command I want to find stack name of Project Browser.If true is pass command.
How do I do ?
You want to use either the revloadedStacks() function, or the openstacks() function. Possibly you're also interested in the mainstacks() function. I suggest you check them all out in the dictionary.
on mouseUp
put revloadedstacks() into field 1
end mouseUp