[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 6 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 :)
User avatar
Dulcamara
 
Posts: 232
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).
:arrow: I'm working with "Blender 2.49b + PyPRP", on "Windows 10 Family x64".
User avatar
Maroonroon
 
Posts: 24
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. :)
User avatar
Dulcamara
 
Posts: 232
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: 1014
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...
:arrow: I'm working with "Blender 2.49b + PyPRP", on "Windows 10 Family x64".
User avatar
Maroonroon
 
Posts: 24
Joined: Sun Jul 06, 2014 5:03 pm
Location: France

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest