Donīt Work video in other places

For questions about using Classic.

Post » Sun Oct 30, 2011 6:17 pm

Hi i have this problem my game have a video, and works in this(\planetajogos\INTRO2.wmv') but if i put the folder in other place, donīt work, i dont know how put in script of video the stuff of appath+. So i put here the link cap of my work , please need some help to finish

http://www.mediafire.com/?xkzs6u1t8rurg98
B
5
G
2
Posts: 47
Reputation: 857

Post » Tue Nov 01, 2011 11:05 am

Som help here :/
B
5
G
2
Posts: 47
Reputation: 857

Post » Tue Nov 01, 2011 1:40 pm

Well Python's counterpart to Construct's AppPath is os.getcwd(), e.g.

movieFile = os.getcwd() + r'\planetajogos\INTRO2.wmv'

But I'm not sure if this is what you're looking for.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Nov 01, 2011 4:40 pm

nop dont works... give this error Traceback(most recent call last): File "<String>", line1, in <module> Name error: name "os" not defined.
B
5
G
2
Posts: 47
Reputation: 857

Post » Tue Nov 01, 2011 7:13 pm

Oh, I see. So you're using some premade Python-script, but you don't know Python yourself?
I'll explain it a little bit more:

'os' is a module. Every module used in another module needs to be imported prior to using it. Insert the following line at the start of your script:

import os

Now Python knows where it has to look for the function getcwd(), so if the next line is

movieFile = os.getcwd() + r'\planetajogos\INTRO2.wmv'

it will look into the module 'os' and search for the function 'getcwd', execute it and return the path to the current working directory, which will then be combined with the second string.

For the basics of Python have a look at various teaching sources in the web, e.g. the wiki book Python Programming. It is essential to know the basics of Python if you intend to use it.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests