Pages and AlcScript / Python [solved]

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Pages and AlcScript / Python [solved]

Postby tachzusamm » Sun Jul 14, 2013 9:48 am

It seems when I put objects in other pages than page 0, either AlcScript ignores them or the belonging Python code does not process those objects.

Example AlcScript (cutout):
Code: Select all
                  - type: sceneobjectlist
                    refs: ['scnobj:ObjInPage0',
                           'scnobj:ObjInPage1]

Both objects export fine, I can see them in the Age.
ObjInPage0 (which is an object exported to page 0 obviously) is processed by my Python code, but ObjInPage1 is not.

How can I do that?
Last edited by tachzusamm on Wed Jul 17, 2013 12:46 am, edited 1 time in total.
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Pages and AlcScript / Python

Postby dendwaler » Sun Jul 14, 2013 10:30 am

In my Opinion there is no need to define the page in the Alctscript.
the only place to define an object is the " page_num" property in the logic window (f4), thats all.
When not i do not understand your question.
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.



Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
User avatar
dendwaler
 
Posts: 936
Joined: Mon Jun 22, 2009 10:49 am
Location: Nederland

Re: Pages and AlcScript / Python

Postby tachzusamm » Sun Jul 14, 2013 10:36 am

I did not mean how to assign objects to pages for export; that works already. I get that object OjbInPage1 exported to another prp (another page) exported fine. No AlcScript needed here, I know.

What does not work is scripting that object, e.g. hiding it with Python using <object>.draw.disable()
This works only for objects exported to page 0.
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Pages and AlcScript / Python

Postby Sirius » Sun Jul 14, 2013 10:55 am

IIRC, AlcScripting for object A will always reference object B or C as part of the same PRP as object A. Which means your python file gets a reference to a sceneobject which does not exist since it's not in the correct PRP.

I don't know whether this can be fixed at all, in case it isn't, the best option is to put all objects in the same PRP. Or edit the PRP after exporting it (obviously not the best way).

EDIT: Tach, try the following reference in your AlcScript:
scnobj:ObjInPage0@Page0Name
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Pages and AlcScript / Python

Postby tachzusamm » Sun Jul 14, 2013 11:36 am

Thank you Sirius.

Unfortunately, putting all objects into the same PRP is not an option if I want to take advantage of your low-memory exporter patch - which works great by the way.

My object(s) which trigger the Python action must be on a page different from the affected objects.
Would using SDL be an option?

But then the next question arises: Is it possible to send SDL messages to only one single player (the player that causes the SDL state change) instead of affecting all other players?

Background: For Relativity, it turned out that using VisRegions alone does not work well because the 3 orthogonal planes, each of them representing a dimension, intersect. So I've set up an active hiding of objects that the player isn't supposed to see when he is in one of the 3 dimensions in Relativity because those objects belong to different dimensions. Of course this should affect only that player who switched to that dimension. This already works well and pleasing, but now I'm sort of stuck when there are lots of objects in the Age which do not export all into the same PRP. PyPRP stops using a memory error. Using multiple pages would solve it.
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Pages and AlcScript / Python

Postby Christian Walther » Sun Jul 14, 2013 11:53 am

Sirius wrote:EDIT: Tach, try the following reference in your AlcScript:
scnobj:ObjInPage0@Page0Name

The documentation for which is here (I have no idea whether it is accurate or complete).
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: Pages and AlcScript / Python

Postby tachzusamm » Sun Jul 14, 2013 12:21 pm

Sirius wrote:EDIT: Tach, try the following reference in your AlcScript:
scnobj:ObjInPage0@Page0Name


Hey, this sound good. I will try it.
Also thank you, Christian.

So if my second "page" has a name like "SecondPage" in the Book, this will be the name to use as well, reading "scnobj:ObjInPage1@SecondPage",
or should it read something like "scnobj:ObjInPage1@Relativity_District_SecondPage"?


UPDATE: It works ! Great!
Thanks to everybody who helped in getting this right.

(scnobj:ObjInPage1@SecondPage was the correct syntax)
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron