Turtle Isle (age problems)

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Re: Turtle Isle (age problems)

Postby dendwaler » Tue Feb 01, 2011 12:49 pm

Status
Touchanimations : working
Sound: working

Textureanimations still continiously looping.

The object name of the cloth is : Cloth1
The material name of Cloth1 is: Journey
The material has two textures
Layer 2 is animated and its name is: Glow
Glow layer refers to the loaded texture also called: Glow

No naming conflicts as far as I see.
I made the material single user because all clothes had it assigned.
It became : Journey.001
I changed the relevant code to:

Code: Select all
 - type: animcmdmsg
                        params:
                            receivers:
                              - 0043:Journey.001-Glow
                            cmds:
                              - continue
                        waiton: 0


?
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: Turtle Isle (age problems)

Postby D'Lanor » Tue Feb 01, 2011 12:58 pm

Is the texture single user as well?
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Turtle Isle (age problems)

Postby D'Lanor » Thu Feb 03, 2011 2:44 pm

If by now you have made the textures single user as well the glow should be working. So let's continue with the SDL for the cloths.

Since you probably want to do as little Python programming as possible we'll start with an existing global Python file: xAgeSDLBoolSet. You can simply call this Python file from your AlcScript to make it do its thing.

First you need SDL variables, as many as there are cloths in your age. Assuming you have 7 cloths, your SDL file should look something like this:

Code: Select all
STATEDESC TurtleIsle
{
   VAR BOOL      trtlCloth1[1]   DEFAULT=0
   VAR BOOL      trtlCloth2[1]   DEFAULT=0
   VAR BOOL      trtlCloth3[1]   DEFAULT=0
   VAR BOOL      trtlCloth4[1]   DEFAULT=0
   VAR BOOL      trtlCloth5[1]   DEFAULT=0
   VAR BOOL      trtlCloth6[1]   DEFAULT=0
   VAR BOOL      trtlCloth7[1]   DEFAULT=0
}

I don't know if your age name is really TurtleIsle, so change that if necessary.

In order to mark the cloths as touched you can change the AlcScript for the Cloth1 object as follows:

Code: Select all
Cloth1:
    visual:
        matanims:
          - mat: Journey.001
            flags:
              - stopped
    logic:
        modifiers:
          - name: Cloth1Clk
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: Cloth1Rgn
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :Cloth1Glowing
              - type: pythonfile
                ref: :Cloth1BoolSet
        actions:
          - type: responder
            name: Cloth1Glowing
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:Cloth1_Seek
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:Cloth1Glowing
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 0043:Journey.001-Glow.001
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Cloth1_se
                            cmds:
                              - play
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: pythonfile
            name: Cloth1BoolSet
            pythonfile:
                file: xAgeSDLBoolSet
                parameters:
                  - type: activator
                    ref: logicmod:Cloth1Clk
                  - type: string
                    value: trtlCloth1
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: int
                    value: 1
                  - type: string
                    value: trtlCloth1

As you can see I have already named your glow texture Glow.001 which is the name it should have gotten when you made it single user. The important parameter is the "type: int". This tells Uru to set SDL trtlCloth1 to value 1. This is NOT a toggle. So if the cloth is clicked twice the SDL value will still be 1.

Next do this for each of your cloths.

OK. That was the easy part. Now you need to tell the door to open only when all cloths are pressed. For this you need to edit the AlcScript of the objects DoorButton, DoorButton.001 and Door1 as follows:

Code: Select all
DoorButton:
    logic:
        modifiers:
          - name: DoorButtonClk
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: DoorButtonRgn
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: :Door1Pyth

DoorButton.001:
    logic:
        modifiers:
          - name: DoorButtonClk.001
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: DoorButtonRgn.001
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: :Door1Pyth

Door1:
    animations:
      - name: DoorOpen1
        autostart: 0
        loop: 0
    logic:
        actions:
          - type: responder
            name: DoorOpen
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:DoorButtonOneshot
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:DoorOpen                   
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:Door1
                            animname: DoorOpen1   
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Door1_se
                            cmds:
                              - play
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            name: DoorOpen.001
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:DoorButtonOneshot.001
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:DoorOpen.001
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:Door1
                            animname: DoorOpen1   
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Door1_se
                            cmds:
                              - play
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            name: DoorStuck
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:DoorButtonOneshot
                        waiton: -1
                    nextstate: 0
                    waittocmd: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            name: DoorStuck.001
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:DoorButtonOneshot.001
                        waiton: -1
                    nextstate: 0
                    waittocmd: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: pythonfile
            name: Door1Pyth
            pythonfile:
                file: trtlDoor1
                parameters:
                  - type: activator
                    ref: logicmod:DoorButtonClk
                  - type: activator
                    ref: logicmod:DoorButtonClk.001
                  - type: string
                    value: "trtlCloth1,trtlCloth2,trtlCloth3,trtlCloth4,trtlCloth5,trtlCloth6,trtlCloth7"
                  - type: responder
                    ref: :DoorOpen
                  - type: responder
                    ref: :DoorOpen.001
                  - type: responder
                    ref: :DoorStuck
                  - type: responder
                    ref: :DoorStuck.001
                  - type: bool
                    value: false


The bad news is that you need a custom made Python file for this, which I called trtlDoor.py. The good news is that I already made it. ;) Here is the code:

Code: Select all
from Plasma import *
from PlasmaTypes import *
import string
actDoorButton = ptAttribActivator(1, 'Act: DoorButton')
actDoorButton1 = ptAttribActivator(2, 'Act: DoorButton.001')
strVarNames = ptAttribString(3, 'SDL Vars to check')
respDoorOpen = ptAttribResponder(4, 'Resp: DoorOpen')
respDoorOpen1 = ptAttribResponder(5, 'Resp: DoorOpen.001')
respDoorStuck = ptAttribResponder(6, 'Resp: DoorStuck')
respDoorStuck1 = ptAttribResponder(7, 'Resp: DoorStuck.001')
boolFirstUpdate = ptAttribBoolean(8, 'Process On First Update?', 0)
class trtlDoor1(ptModifier,):

    def __init__(self):
        ptModifier.__init__(self)
        self.version = 1
        minor = 0
        self.me = self.__class__.__name__
        self.SDLlist = []
        print ('__init__%s v. %d.%d' % (self.me,
         self.version,
         minor))



    def OnFirstUpdate(self):
        try:
            self.SDLlist = strVarNames.value.split(',')
            for i in range(len(self.SDLlist)):
                self.SDLlist[i] = self.SDLlist[i].strip()

            PtDebugPrint(('%s: SDL list = %s' % (self.me,
             self.SDLlist)))
        except:
            PtDebugPrint(("ERROR: %s.OnFirstUpdate():\tERROR: couldn't process SDL list" % self.me))
            return
        if boolFirstUpdate.value:
            self.OnServerInitComplete()



    def OnServerInitComplete(self):
        ageSDL = PtGetAgeSDL()
        for i in range(len(self.SDLlist)):
            try:
                ageSDL.sendToClients(self.SDLlist[i])
                ageSDL.setFlags(self.SDLlist[i], 1, 1)
                ageSDL.setNotify(self.key, self.SDLlist[i], 0.0)
            except:
                PtDebugPrint(("ERROR: %s.OnServerInitComplete():\tERROR: couldn't process SDL %s" % (self.me,
                 self.SDLlist[i])))




    def OnNotify(self, state, id, events):
        ageSDL = PtGetAgeSDL()
        solved = 1
        for i in range(len(self.SDLlist)):
            if (not ageSDL[self.SDLlist[i]][0]):
                solved = 0
                break

        objAvatar = PtFindAvatar(events)
        if ((id == actDoorButton.id) and state):
            if solved:
                respDoorOpen.run(self.key, avatar=objAvatar, netPropagate=0)
            else:
                respDoorStuck.run(self.key, avatar=objAvatar, netPropagate=0)
        elif ((id == actDoorButton1.id) and state):
            if solved:
                respDoorOpen1.run(self.key, avatar=objAvatar, netPropagate=0)
            else:
                respDoorStuck1.run(self.key, avatar=objAvatar, netPropagate=0)



glue_cl = None
glue_inst = None
glue_params = None
glue_paramKeys = None
try:
    x = glue_verbose
except NameError:
    glue_verbose = 0

def glue_getClass():
    global glue_cl
    if (glue_cl == None):
        try:
            cl = eval(glue_name)
            if issubclass(cl, ptModifier):
                glue_cl = cl
            elif glue_verbose:
                print ('Class %s is not derived from modifier' % cl.__name__)
        except NameError:
            if glue_verbose:
                try:
                    print ('Could not find class %s' % glue_name)
                except NameError:
                    print 'Filename/classname not set!'
    return glue_cl



def glue_getInst():
    global glue_inst
    if (type(glue_inst) == type(None)):
        cl = glue_getClass()
        if (cl != None):
            glue_inst = cl()
    return glue_inst



def glue_delInst():
    global glue_inst
    global glue_cl
    global glue_paramKeys
    global glue_params
    if (type(glue_inst) != type(None)):
        del glue_inst
    glue_cl = None
    glue_params = None
    glue_paramKeys = None



def glue_getVersion():
    inst = glue_getInst()
    ver = inst.version
    glue_delInst()
    return ver



def glue_findAndAddAttribs(obj, glue_params):
    if isinstance(obj, ptAttribute):
        if glue_params.has_key(obj.id):
            if glue_verbose:
                print 'WARNING: Duplicate attribute ids!'
                print ('%s has id %d which is already defined in %s' % (obj.name,
                 obj.id,
                 glue_params[obj.id].name))
        else:
            glue_params[obj.id] = obj
    elif (type(obj) == type([])):
        for o in obj:
            glue_findAndAddAttribs(o, glue_params)

    elif (type(obj) == type({})):
        for o in obj.values():
            glue_findAndAddAttribs(o, glue_params)

    elif (type(obj) == type(())):
        for o in obj:
            glue_findAndAddAttribs(o, glue_params)




def glue_getParamDict():
    global glue_paramKeys
    global glue_params
    if (type(glue_params) == type(None)):
        glue_params = {}
        gd = globals()
        for obj in gd.values():
            glue_findAndAddAttribs(obj, glue_params)

        glue_paramKeys = glue_params.keys()
        glue_paramKeys.sort()
        glue_paramKeys.reverse()
    return glue_params



def glue_getClassName():
    cl = glue_getClass()
    if (cl != None):
        return cl.__name__
    if glue_verbose:
        print ('Class not found in %s.py' % glue_name)
    return None



def glue_getBlockID():
    inst = glue_getInst()
    if (inst != None):
        return inst.id
    if glue_verbose:
        print ('Instance could not be created in %s.py' % glue_name)
    return None



def glue_getNumParams():
    pd = glue_getParamDict()
    if (pd != None):
        return len(pd)
    if glue_verbose:
        print ('No attributes found in %s.py' % glue_name)
    return 0



def glue_getParam(number):
    pd = glue_getParamDict()
    if (pd != None):
        if (type(glue_paramKeys) == type([])):
            if ((number >= 0) and (number < len(glue_paramKeys))):
                return pd[glue_paramKeys[number]].getdef()
            else:
                print ('glue_getParam: Error! %d out of range of attribute list' % number)
        else:
            pl = pd.values()
            if ((number >= 0) and (number < len(pl))):
                return pl[number].getdef()
            elif glue_verbose:
                print ('glue_getParam: Error! %d out of range of attribute list' % number)
    if glue_verbose:
        print 'GLUE: Attribute list error'
    return None



def glue_setParam(id, value):
    pd = glue_getParamDict()
    if (pd != None):
        if pd.has_key(id):
            try:
                pd[id].__setvalue__(value)
            except AttributeError:
                if isinstance(pd[id], ptAttributeList):
                    try:
                        if (type(pd[id].value) != type([])):
                            pd[id].value = []
                    except AttributeError:
                        pd[id].value = []
                    pd[id].value.append(value)
                else:
                    pd[id].value = value
        elif glue_verbose:
            print "setParam: can't find id=",
            print id
    else:
        print 'setParma: Something terribly has gone wrong. Head for the cover.'



def glue_isNamedAttribute(id):
    pd = glue_getParamDict()
    if (pd != None):
        try:
            if isinstance(pd[id], ptAttribNamedActivator):
                return 1
            if isinstance(pd[id], ptAttribNamedResponder):
                return 2
        except KeyError:
            if glue_verbose:
                print ('Could not find id=%d attribute' % id)
    return 0



def glue_isMultiModifier():
    inst = glue_getInst()
    if isinstance(inst, ptMultiModifier):
        return 1
    return 0



def glue_getVisInfo(number):
    pd = glue_getParamDict()
    if (pd != None):
        if (type(glue_paramKeys) == type([])):
            if ((number >= 0) and (number < len(glue_paramKeys))):
                return pd[glue_paramKeys[number]].getVisInfo()
            else:
                print ('glue_getVisInfo: Error! %d out of range of attribute list' % number)
        else:
            pl = pd.values()
            if ((number >= 0) and (number < len(pl))):
                return pl[number].getVisInfo()
            elif glue_verbose:
                print ('glue_getVisInfo: Error! %d out of range of attribute list' % number)
    if glue_verbose:
        print 'GLUE: Attribute list error'
    return None

If you haven't worked with SDL states and Python before I suggest you read what Andy posted in this topic about the "Dummy" python file.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Turtle Isle (age problems)

Postby dendwaler » Fri Feb 04, 2011 7:47 am

Thx D'Lanor for all the effort taken on this.

I will implement it as soon as possible!

It wil take some time, because I had a serious PC crash last wednesday after the weekly microsoft update.
It resulted in a black screen of death with a useless cursor in the middle.

I had to do a complete install of w7 again
I also have upgraded my system with another 1.5 TB harddisk.
Luckily I have no datalosses.
But the path to all my textures, blend and audio files have changed.
It took me lots of time to get that right again.
But i just finished my first complete export again.
I only get one deprecation error message at the end , i don't know yet what coarsed it.
But the export was successfull, so I can continue building.
let you know when your code is working.

Oh yes, the glowing effect is there now!
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: Turtle Isle (age problems)

Postby Chuckles58 » Fri Feb 04, 2011 5:21 pm

I'm glad you had your data safe, Dendwaler. Your Turtle Isle has been anxiously anticipated by us wannabe age builders.

With hard disks, it's not IF they will crash, it is WHEN they will crash. Thank goodness external HDs are so cheap now.
Image<----Click for info
User avatar
Chuckles58
 
Posts: 169
Joined: Sat Mar 22, 2008 6:34 pm
Location: DFW, Texas

Re: Turtle Isle (age problems)

Postby dendwaler » Tue Feb 08, 2011 7:18 am

Thx Chuckles for your mental support.

I still have problems on the same issue.
I made upto 5 clothes that started glowing when touched.
When i made the next when , none of the clothes where working any longer.
But even when i go back to an older saving they don't work again.
When i go back to the situation before the clothes where made and restart making the clothes again, then it works.
And the same thing happened again when making number six.
I am really puzzled what i do wrong , until now i could not even try what D'Lanor made for me.
I am convinced that it has to do with a wrong connection with layers and ipo curves, but cannot find it.

And i get this error at the end of my export.
I don't know what it means.
(this error does not prohibit the age from working however)
Attachments
Blender_2011-02-08_15-02-24.jpg
Blender_2011-02-08_15-02-24.jpg (21.1 KiB) Viewed 4646 times
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: Turtle Isle (age problems)

Postby D'Lanor » Tue Feb 08, 2011 9:23 am

Are you sure it is not the multiple user thing again?
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Turtle Isle (age problems)

Postby dendwaler » Tue Feb 08, 2011 1:19 pm

D'Lanor wrote:Are you sure it is not the multiple user thing again?


Well, may be,
but I can't find it.
I started to set up a basic empty age (plane) with 7 clothes in it on 1 wall.
When it is working, i will export it to turtle Isle.
and leave the test age as an example for others in the wiki.
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: Turtle Isle (age problems)

Postby Jojon » Tue Feb 08, 2011 1:20 pm

Obtusely, I must ask: would that be single user *Texture* block, or single user *Image* block and if the latter; that won't result in an extra copy in memory, of one and the same bitmap, then?
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: Turtle Isle (age problems)

Postby D'Lanor » Tue Feb 08, 2011 1:33 pm

Material and texture blocks must be single user. They can use the same image block AFAIK.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

PreviousNext

Return to Building

Who is online

Users browsing this forum: No registered users and 1 guest