help between scene's python

hi i have 2 scene’s Scene1 is the whole game and Scene2 is a shop for my game
now i have the shop as a add overlayScene when im klik on the shop owner and then i set the Scene1 as suspend Scene
now i have coins to buy things and i have it so that if i click on the plane with the text as if i want to buy some arrows
i have made a small script but i dont know how to get is to work
i have ge text with the texture as @
arrows1 is when im click on the plane
but how do i get is to work this code is on the Scene2 but how do i get the script to see what object i mean i now get a error with the text
the script i hase the name of shop
Traceback (most recent call last):
File “shop”, Line 4, in <module>
KeyError: "’ ’ OBarrows’ ’ not in list

cont = GameLogic.getCurrentController()
own = cont.getOwner()
ownarrows = GameLogic.getCurrentScene("Scene1").getObjectList()["OBarrows"]
owncoins = GameLogic.getCurrentScene("Scene1").getObjectList()["OBcoins"]
arrows1 = cont.getSensor("arrows1")
if arrows1.isPositive():
 owncoins.Text -= 5
 ownarrows.Text += 1

You can store data in global objects such as GameLogic.

Any attribute you assign to GameLogic is accessible from anywhere in the game.

### SCENE 1 ###
GameLogic.coins = own.coins  # Setting GameLogic attribute "coins" to the value of the propery "coins" on the owner object.

### SCENE 2 ###
own.coins = GameLogic.coins   # Setting property "coins" to value of GameLogic attribute "coins".

If you’re still confused, do say so, because I didn’t explain it very well.
Someone else will surely help you.

Off to bed I go,

thx i understand it
il try it now

it dont work cuz i have the property caled (Text) and it is the object name (coins)
is there some other way cus it now gives a error attributeError: coins

im still need help on this 1 how cud i doe it the best way with my python

dos some1 know this problem Chaser idea dosent work cuz my object is a plane with a texture @ in it and the property is a Text with capital T so the objects name is arrows or coins but not the property cuz of them both it is Text what did i do wrong with the code i made cuz it only cant find the the objects in the scene1 the script seems to work only on the same scene as the shop is in and that is scene2 and the number of arrows is on the scene1 is there some way to conect those 2 scenes for only the object Chaser sounds logical but it dont work with the Text property only with normal property’s

please help me

I’ll be glad to help if you can present your problem in a readable format.

Like this.

Skip lines, use periods, and don’t use slang.

sorry my bad
i have 2 property’s both have a Text property that shows ingame the arrows, and the coins

ive made a script as you can see above but both of the property’s are in the ‘Scene1’

now when im click on the shop human then the ‘Scene2’ oppears in a add overlay Scene Actuator, and the ‘Scene1’ is suspend with a Actuator

now i have the shop that shows a plane and the text on it “would you like to buy a arrow”

now when im click on the plane then i have it so that the python comes to life what i script above

but when im want it to do the script it cant find the property’s on scene1 how do i get them to find the object’s coins and arrows and change the Text property’s

cuz i want it that there gos 5 coins off and add 1 arrow to the arrows property Text
hope this helps

Much better!

ownarrows = GameLogic.getCurrentScene("Scene1").getObjectList()["OBarrows"]
owncoins = GameLogic.getCurrentScene("Scene1").getObjectList()["OBcoins"]

These are the two variables you want to carry to the other scene, correct?

Here’s what you have to do:

cont = GameLogic.getCurrentController()
own = cont.getOwner()

GameLogic.ownarrows = GameLogic.getCurrentScene("Scene1").getObjectList()["OBarrows"]
GameLogic.owncoins = GameLogic.getCurrentScene("Scene1").getObjectList()["OBcoins"]

What that does is make ownarrows and owncoins global variables, just like Chaser was describing earlier. It should work. Now, use GameLogic.ownarrows when you mean ownarrows.

If you’re having the same problem, why don’t you just upload the .blend

thx il try it now
do i have to put something to the arrows and coins some sort of scrip??? thats my only question

In scene 2? Yes…

GameLogic.getCurrentScene("Scene2").getObjectList()["OBarrows"] = ownarrows
GameLogic.getCurrentScene("Scene2").getObjectList()["OBcoins"] = GameLogic.owncoins

just use something like to upload the file and gimme a link

i have a smal error in the script i have it now so that GAmeLogic.arrows and the whole line
it has a error the says KeyError "’ ’ OBcoins’ ’ not in list
do i need to set something in scene1 cus i now have it on scene2 where the shop is
do i need to set some sort of python so it reconize the object and how do i set the code then

never mind

So it’s working?

no its not working now i get a error with
TypeError: ‘CListValue’ object does not support item assignment
i dont get its in the scene2 by the shop python just show above

and i put it so that the its just like erROAR say’s in his last script

Upload the file, if you could. I suggest a site like savefile. Then I’ll be able to troubleshoot a lot more quickly

i want the file to myself i have put alot of work in it and i want it to be private i make a really big game til its almost as good to play il post some good wip then but now its not that good so i keep it tomyself if you can understand

I sent you a private message