Page 1 of 2
xAgeSDLIntChange / responder
Posted: Sun Mar 31, 2013 6:46 am
by Render
Hi again,
Anyone experience with xAgeSDLIntChange and the corresponding responder?
Trying to create something where pushing a button a second (or third, fourth....) time will trigger a different respons.
It seems logical to use xAgeSDLIntChange, but what kind of responder should I use then, is it the xAgeSDLIntRespList ? and if so, what is the Alcscript to use.
Here is what i want to do:
Press button, animation of object for 1/4, press second time animation of object starts at 1/4 and ends at 1/2 en so on.
Based on the example given in the WIKI, I think I understand the IntChange, but as said, don't know how to set up the responder.
Thanks in advance
Re: xAgeSDLIntChange / responder
Posted: Sun Mar 31, 2013 5:26 pm
by D'Lanor
I have only used xAgeSDLIntChange in combination with xAgeSDLIntShowHide which works great. This simply pops objects in and out of view though which is not what you are looking for.
I guess xAgeSDLIntRespList should work for this. Or perhaps xAgeSDLIntStartStopResp. Unfortunately the wiki documentation is incomplete because I never got around to testing and documenting these. I can have a look at xAgeSDLIntRespList next week and reverse engineer some Alcscript from the Python code.
Re: xAgeSDLIntChange / responder
Posted: Mon Apr 01, 2013 3:06 am
by Render
Thanks for the response D'Lanor, I was afraid this was the case (judging from the lack of information in the WIKI).
If you wouldn't mind looking at it at your earliest convenience, I would be grateful as usual.
Greets,
Render
Re: xAgeSDLIntChange / responder
Posted: Mon Apr 01, 2013 10:40 am
by Render
Done some playing around withit, but can't get it to work, probably because i don't quite understand enough.
Some of the indentation didn't come through correctly, I am sure it is ok in the original file though.
I also just noticed i put the IntRepList peace in twice, so one of them will probably have to go, but that does not seem to be the problem
This is what i've got:
Code: Select all
Cone:
animations:
- name: anim2
autostart: 0
loop: 0
loopstart: 0
loopend: 3
- name: anim3
autostart: 0
loop: 0
loopstart: 3
loopend: 6
- name: anim4
autostart: 0
loop: 0
loopstart: 6
loopend: 9
- name: anim1
autostart: 0
loop: 0
loopstart: 9
loopend: 12
logic:
actions:
- type: pythonfile
tag: Intresp
pythonfile:
file: xAgeSDLIntRespList
parameters:
- type: string
value: ConePos
- type: string
value: Resp00, Resp01, Resp02, Resp03
- type: string
value: Resp0%d
- type: int
value: 3
- type: bool
value: 0
- type: bool
value: 1
- type: responder
name: Resp00
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim1
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
name: Resp01
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim2
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
name: Resp02
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim3
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
name: Resp03
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim4
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
Cube:
logic:
modifiers:
- tag: StateAnim
cursor: poised
flags:
- localelement
activators:
- type: objectinvolume
remote: ClickRegion
triggers:
- any
conditions:
- type: activator
activators:
- type: picking
- type: objectinbox
satisfied: true
actions:
- type: pythonfile
ref: $IntChange
actions:
- type: pythonfile
tag: IntChange
pythonfile:
file: xAgeSDLIntChange
parameters:
- type: activator
ref: logicmod:$StateAnim
- type: string
value: ConePos
- type: bool
value: true
- type: bool
value: false
- type: int
value: 0
- type: int
value: 3
- type: bool
value: true
- type: skip
- type: int
value: 0
- type: pythonfile
tag: Intresp
pythonfile:
file: xAgeSDLIntRespList
parameters:
- type: string
value: ConePos
- type: string
value: Resp00,Resp01,Resp02,Resp03
- type: string
value: Resp0%d
- type: int
value: 3
- type: bool
value: 0
- type: bool
value: 1
- type: responder
name: Resp00
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim1
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
name: Resp01
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim2
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
name: Resp02
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim3
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
name: Resp03
responder:
states:
- cmds:
- type: animcmdmsg
params:
receivers:
- 006D:Cone
animname: anim4
cmds:
- continue
waiton: -1
nextstate: 1
waittocmd: 0
curstate: 0
flags:
- detecttrigger
It seems to work partly, as this is what Python.0.elf says:
Code: Select all
(04/01 19:27:16) xKI.OnServerInitComplete(): age = test
(04/01 19:27:16) DEBUG: xAgeSDLIntChange.OnServerInitComplete(): ConePos = 0
(04/01 19:27:16) DEBUG: xAgeSDLIntRespList.OnServerInitComplete: Processing
(04/01 19:27:16) DEBUG: xAgeSDLIntRespList.OnServerInitComplete: Processing
(04/01 19:27:16) _UamEvents._OnAvatarSpawn
(04/01 19:27:16) _UamModReltopages.UamOnNewAgeLoaded
(04/01 19:27:35) DEBUG: xAgeSDLIntChange.OnNotify(): local player requesting ConePos change via Cube_StateAnim
(04/01 19:27:35) DEBUG: xAgeSDLIntChange.OnNotify(): incremented age SDL var ConePos to 1
(04/01 19:27:35) DEBUG: xAgeSDLIntChange.OnSDLNotify(): VARname:ConePos, SDLname:test, tag:, value:1
(04/01 19:27:35) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:35) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 1
(04/01 19:27:35) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:35) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 1
(04/01 19:27:37) DEBUG: xAgeSDLIntChange.OnNotify(): local player requesting ConePos change via Cube_StateAnim
(04/01 19:27:37) DEBUG: xAgeSDLIntChange.OnNotify(): incremented age SDL var ConePos to 2
(04/01 19:27:37) DEBUG: xAgeSDLIntChange.OnSDLNotify(): VARname:ConePos, SDLname:test, tag:, value:2
(04/01 19:27:37) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:37) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 2
(04/01 19:27:37) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:37) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 2
(04/01 19:27:40) DEBUG: xAgeSDLIntChange.OnNotify(): local player requesting ConePos change via Cube_StateAnim
(04/01 19:27:40) DEBUG: xAgeSDLIntChange.OnNotify(): incremented age SDL var ConePos to 3
(04/01 19:27:40) DEBUG: xAgeSDLIntChange.OnSDLNotify(): VARname:ConePos, SDLname:test, tag:, value:3
(04/01 19:27:40) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:40) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 3
(04/01 19:27:40) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:40) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 3
(04/01 19:27:43) DEBUG: xAgeSDLIntChange.OnNotify(): local player requesting ConePos change via Cube_StateAnim
(04/01 19:27:43) DEBUG: xAgeSDLIntChange.OnNotify(): incremented age SDL var ConePos to 0
(04/01 19:27:43) DEBUG: xAgeSDLIntChange.OnSDLNotify(): VARname:ConePos, SDLname:test, tag:, value:0
(04/01 19:27:43) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:43) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 0
(04/01 19:27:43) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:43) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 0
(04/01 19:27:45) DEBUG: xAgeSDLIntChange.OnNotify(): local player requesting ConePos change via Cube_StateAnim
(04/01 19:27:45) DEBUG: xAgeSDLIntChange.OnNotify(): incremented age SDL var ConePos to 1
(04/01 19:27:45) DEBUG: xAgeSDLIntChange.OnSDLNotify(): VARname:ConePos, SDLname:test, tag:, value:1
(04/01 19:27:45) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:45) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 1
(04/01 19:27:45) DEBUG: xAgeSDLIntRespList.OnSDLNotify(): notification from PlayerID: 20001
(04/01 19:27:45) DEBUG: xAgeSDLIntRespList.OnSDLNotify received: ConePos = 1
The reponders however don't kick in.
Hopefully this will save you some time investigating the python file.
I have assumed the RespList variable should contain the responders, but maybe that is where i am going wrong.
Anyway, eagerly anticipating your respons (I know, I am very impatient)
Re: xAgeSDLIntChange / responder
Posted: Mon Apr 01, 2013 2:49 pm
by D'Lanor
I haven't had time to look at this yet, but it seems you are doing a good job figuring it out by yourself. At a quick glance I did notice one big showstopper: Your responderlist should not be of the type string. Can you try this?
Code: Select all
- type: responderlist
refs: ['Resp00', 'Resp01', 'Resp02', 'Resp03']
Re: xAgeSDLIntChange / responder
Posted: Mon Apr 01, 2013 2:58 pm
by Render
Your the man, that did the trick!
It is working in my test age, now i need to port it to my actual age and turn it into a real puzzle.
Thanks a million !!!!
Re: xAgeSDLIntChange / responder
Posted: Tue Apr 02, 2013 8:34 am
by Render
OK, I am incorporating the globals in to my age, I think I found a flaw in the xAgeIntChange.py.
I noticed the decrement parameter doesn't work.
Inspecting the actual python file, i noticed this:
Code: Select all
ageSDL = PtGetAgeSDL()
if not boolInc.value and not boolDec.value: # not a counter
stringOp = "set"
intCurrentValue = intSetTo.value
elif boolInc.value:
stringOp = "incremented"
if intCurrentValue < intMax.value:
intCurrentValue = intCurrentValue + 1
elif boolLoop.value:
intCurrentValue = intMin.value
else:
intCurrentValue = intMax.value
elif boolDec.value:
stringOp = "decremented"
if intCurrentValue >[color=#FF0000] intMax.value:[/color]
intCurrentValue = intCurrentValue - 1
elif boolLoop.value:
intCurrentValue = intMax.value
else:
intCurrentValue = intMin.value
Although I am not a python coder, i think this should be inMin.value
I amended the file and renamed it, put it in my pak file and now it works as expected.
Can anyone please confirm this is indeed flawed in the original file and make the neccesary changes ?
Comming this far, I am now presented with another chalange:
I want my animations to respond to play to a certain stage, but starting at whatever position they were in, so I can't use loopstart loopend.
There seem to be a number of solutions here, but I don't know how to use them.
What comes to mind are: resume, playtotime or playtopercentage.
Can anyone tell me how to use these, preferably with an alcscript example.
Thanks in advance!
Re: xAgeSDLIntChange / responder
Posted: Wed Apr 03, 2013 4:32 pm
by D'Lanor
Yes, I believe you are right. I don't think Cyan has actually used the increment or decrement options in any released age. I only tested the increment option so I suppose you are the first to notice the decrement error.
Re: xAgeSDLIntChange / responder
Posted: Wed Apr 03, 2013 4:40 pm
by D'Lanor
I'm not sure what you mean. If you loop through the sdl values by decrement each animation always resumes from the same stage. That means you can use loopstart loopend.
I don't know how those advanced animation commands work (if they are even fully implemented in PyPRP).
Re: xAgeSDLIntChange / responder
Posted: Wed Apr 03, 2013 8:28 pm
by Branan
Yes, you're absolutely correct about that! If you could please open a pull request with your change against
https://github.com/H-uru/moul-scripts, it would be greatly appreciated!