[Blender-PyPRP-AlcScript] soundfx isn't playing

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

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Dulcamara » Sun Oct 01, 2017 3:00 am

Hello Maroonroon, :)
soory i could not replay earlyer

I found the errors in my script and now it works, I think.
I also used Blender "parenting" for the different objects that slides with the door.


Yes, parenting i also use.
You changed ButtonTouch to Touch button. Was that a part of an error?
Anyway your Door work perfectly now.

I will send you another small Blendfile (include Python and SDL) to learn and study to use the SDL and the Python.

Door2.7z
(790.81 KiB) Downloaded 454 times



I am not able to change it in your script in a short time. I am too bussy and it is very hard for me to understand such things. :oops:
Maybe we can help each other. :)

Caution i changed the Age number in 473
I think it is a free Sequence Prefixe.
So i gave the Door2.py the number 47301 and the Door2AgeSDLBoolRespondReset the number 47302

So you can later , if you work with more Pythonfiles, count 03, 04 ....

I hope this all help you and i wait of your response
Greetings
Dulcamara :)
Dulcamara
 
Posts: 376
Joined: Fri Sep 03, 2010 11:06 am
Location: Alabaster

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Maroonroon » Sun Oct 01, 2017 3:51 am

Dulcamara wrote:Hello Maroonroon, :)
soory i could not replay earlyer

I found the errors in my script and now it works, I think.
I also used Blender "parenting" for the different objects that slides with the door.


Yes, parenting i also use.
You changed ButtonTouch to Touch button. Was that a part of an error?

Yes it was, the door animation wasn't waiting for the avatar to touch the button, to open itself ; but there was some other errors, typos, bad indentations...

Anyway your Door work perfectly now.

I will send you another small Blendfile (include Python and SDL) to learn and study to use the SDL and the Python.

Door2.7z



I am not able to change it in your script in a short time. I am too bussy and it is very hard for me to understand such things. :oops:
Maybe we can help each other. :)

Caution i changed the Age number in 473
I think it is a free Sequence Prefixe.
So i gave the Door2.py the number 47301 and the Door2AgeSDLBoolRespondReset the number 47302

So you can later , if you work with more Pythonfiles, count 03, 04 ....

I hope this all help you and i wait of your response
Greetings
Dulcamara :)

Thank you very much Dulcamara, it's exactly what I was looking for, I think. :)
I'll download it tomorow (I'm not at home).
User avatar
Maroonroon
 
Posts: 219
Joined: Sun Jul 06, 2014 5:03 pm
Location: France

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Dulcamara » Sun Oct 01, 2017 4:21 am

I'm very curious about your progress. :)
Dulcamara
 
Posts: 376
Joined: Fri Sep 03, 2010 11:06 am
Location: Alabaster

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Deledrius » Tue Oct 03, 2017 12:53 am

Maroonroon wrote:The next step is to load/save the sliding door state (opened or closed)...
I used PlasmaShop to create a "a.sdl" file, and I tried different quickscript but they don't works for my sliding door.
I think I have to use python...
Then, I used PlamaShop to create a "a.py" and a "a.pak" files, I edited the "a.py" file to change the class name and the "__init__ self.id", but I don't know how to use the "a.py" file itself now. :?
  • How to call my python file in Alscript?
  • How to check the current state of the door?
  • How to change the state of the door (for both of the buttons at the same time, depending of the current state of the door)?
It will be a public Age.

You shouldn't need to write your own, as Uru comes with a nice collection of global scripts for just such interactions. In fact it's a bad idea to use custom scripts for this sort of common thing, as you won't benefit from improvements of bug fixes, and re-inventing the wheel is a lot of work to achieve little reward. For doors, a few options come to mind:

  • xAgeSDLBoolRespond for the general case, where you have a responder you want to activate based on the state of an SDL boolean (true or false).
  • xStarTrekDoor is for a simple door that automatically opens when someone walks into a region (usually around the door) and closes when they leave it.
  • xStandardDoor is probably the best fit for you, since this is made for a door that has activators (the clickable buttons) and is open or closed based on an SDL variable.

I would recommend starting with xStandardDoor since you have a door with clickable buttons.

IIRC, for alcscript, you create a pythonfile and then give it the arguments it expects for that file (look at the start of the file for the list of ptAttribs). xStandardDoor requires a bit more than the xStarTrekDoor but you've already set most of it up. More info is here on the wiki: https://guildofwriters.org/wiki/Global_Python_Scripts . You will need to create an SDL file if you haven't already, and either way add the variable VAR BOOL Door01Closed[1] DEFAULT=1 for the door state.

The alcscript should look something like this:
Code: Select all
Door01:
    logic:
        actions:
          - type: pythonfile
            tag: Door01Toggle
            pythonfile:
                file: xStandardDoor
                parameters:
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: string
                    value: Door01Closed
                  - type: skip
                  - type: activator
                    ref: logicmod:Door01Button01
                  - type: responder
                    ref: respondermod:Door01OpenClose01
                  - type: activator
                    ref: logicmod:Door01Button02
                  - type: responder
                    ref: respondermod:Door01OpenClose02
                  - type: skip
                  - type: responder
                    ref: respondermod:Door01OpenClose01
                  - type: responder
                    ref: respondermod:Door01OpenClose02

I'm very rusty, so I hope I did this correctly. There are a few more options the script provides (for instance: an "exclude region" that blocks avatars from standing in the door when it's closing), so you may want to check those out, but this will give you the basic functionality.
User avatar
Deledrius
Gehn Shard Admin
 
Posts: 1377
Joined: Mon Oct 01, 2007 1:21 pm

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Maroonroon » Fri Oct 06, 2017 12:25 pm

Hello Deledrius;

I tried many different scripts but none worked.
Either the state of the door isn't saved,
either, with only one click on one of the Buttons, the avatar goes on the SeekPoint02 to open the door, and goes to the SeekPoint01 to open the door "again",
either the buttons are not clickable,
either the buttons are clickable but nothing happens when I click... :?

Edit:
It's still in the same situation ; but being updating the "real" blend file of this age, I saw that some seekpoints of the sliding-doors buttons are too much near a wall... :?
Why "left hand" avatar animations (but the KI insert) doesn't exists!? :roll:
Then, I will use another way to open/close the sliding-doors ; probably using a clickable button to open it, and a region to close it, so, without sdl state.
I will tell you if I manage to do that.

Edit2:
I don't manage to do that.
I leave AlcScript, and will wait using korman to work on this kind of things...
User avatar
Maroonroon
 
Posts: 219
Joined: Sun Jul 06, 2014 5:03 pm
Location: France

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Maroonroon » Tue Oct 22, 2019 12:26 pm

Hello.

I'm back trying to open/close a sliding door in the "a" Age, but nothing happens when I click on any of the two buttons...
I also would like to add an "Exclude Region", but I don't manage to write the right AlcScript.
Can you help me please?

Book: Show Spoiler

AlcScript: Show Spoiler

a.py: Show Spoiler

a.sdl: Show Spoiler
User avatar
Maroonroon
 
Posts: 219
Joined: Sun Jul 06, 2014 5:03 pm
Location: France

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Doobes » Tue Oct 22, 2019 2:06 pm

Maroonroon wrote:Hello.

I'm back trying to open/close a sliding door in the "a" Age, but nothing happens when I click on any of the two buttons...
I also would like to add an "Exclude Region", but I don't manage to write the right AlcScript.
Can you help me please?



I sure can! I actually helped Tweek with a very similar problem. Your best bet is to utilize the xStandardDoor script. Give me some time to work on the AlcScript voodoo. :)

EDIT: Cyan was kind enough to provide a script for just this occasion with xStandardDoor, which is what I've used. I also inserted, but commented out, some loopstart and loopend lines if you'd like to use those. Give the following AlcScript a try.

Be sure to change "ExcludeRegionObjectHere" to the name of your exclude region object in Blender.

Show Spoiler
KI #s: MOULa - 6302, Minkata - 35287, Gehn - 14291,
TOC - 82340, DI - 44387
Image
User avatar
Doobes
 
Posts: 216
Joined: Thu Aug 07, 2008 6:08 pm
Location: Savannah, GA, USA

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Maroonroon » Tue Oct 22, 2019 4:23 pm

Doobes wrote:I sure can! I actually helped Tweek with a very similar problem. Your best bet is to utilize the xStandardDoor script. Give me some time to work on the AlcScript voodoo. :)

EDIT: Cyan was kind enough to provide a script for just this occasion with xStandardDoor, which is what I've used. I also inserted, but commented out, some loopstart and loopend lines if you'd like to use those. Give the following AlcScript a try.

Be sure to change "ExcludeRegionObjectHere" to the name of your exclude region object in Blender.

Thank you for you answer, Doobes, sadly, same result.
I'm not sure at all about my "a.py" file... Is that file right?

P.S: I use a batch file to delete the previous export, and to open the "<Game folder URL>\sav\<avatarNumber>\current\" folder, where I delete the "<AgeName>_<randomString>.sav" file by my own.

DeletePreviousExport.bat: Show Spoiler
Last edited by Maroonroon on Tue Oct 29, 2019 5:04 am, edited 5 times in total.
User avatar
Maroonroon
 
Posts: 219
Joined: Sun Jul 06, 2014 5:03 pm
Location: France

Re: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby dendwaler » Thu Oct 24, 2019 2:00 am

either, with only one click on one of the Buttons, the avatar goes on the SeekPoint02 to open the door, and goes to the SeekPoint01 to open the door "again",


I remember that these weird behaviour is the result of copying objects in blender.
All involved elements have to be set as single user in Blender for each of its properties.
Though nothing can be shared.

So in your case the script is probably fine, but the blendfile not.

ps,
i downloaded your age, but can't look into it before the weekend.
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: [Blender-PyPRP-AlcScript] soundfx isn't playing

Postby Doobes » Thu Oct 24, 2019 3:45 am

I noticed in your a.py file that you're importing some of the global scripts such as xAgeSDLBoolToggle and xStandardDoor. No need for that as Cyan has those built in. Not sure if that's affecting things, but it'll at least save you some time.

As for the AlcScript, I touched things up a bit. Let's give this a try:

EDIT: I noticed, in one place, I used "book" instead of "bool". Oops! It's fixed now. :P

Show Spoiler
KI #s: MOULa - 6302, Minkata - 35287, Gehn - 14291,
TOC - 82340, DI - 44387
Image
User avatar
Doobes
 
Posts: 216
Joined: Thu Aug 07, 2008 6:08 pm
Location: Savannah, GA, USA

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 5 guests