Jump to content

Need some help with scripting


cg1985

Recommended Posts

Hey .. I need some more help.

 

I want to show and hide objects with objectRef.enable and objectRef.disable ... Here's my script:

 

scn SomePosesChapter01Script

 

Int SomePosesPage

 

BEGIN OnActivate

 

set SomePosesPage to 0

 

If SomePosesPage == 0

 

If IsKeyPressed 205 == -1

Return

elseIf IsKeyPressed 205 == 1

set SomePosesPage to 1

SomePosesChapter01CoverRef.Disable 0

SomePosesChapter01Page001Ref.Enable 0

elseIf IsKeyPressed 203 == 1

set SomePosesPage to 0

SomePosesChapter01Page001Ref.Disable 0

SomePosesChapter01CoverRef.Enable 0

EndIf

EndIf

 

If SomePosesPage == 1

If IsKeyPressed 205 == -1

Return

elseIf IsKeyPressed 205 == 1

set SomePosesPage to 2

SomePosesChapter01Page001Ref.Disable 0

SomePosesChapter01Page002Ref.Enable 0

elseIf IsKeyPressed 203 == 1

set SomePosesPage to 1

SomePosesChapter01Page002Ref.Disable 0

SomePosesChapter01Page001Ref.Enable 0

EndIf

EndIf

 

END

 

So the objects which I want to hide and show are located in the same position ... Object 1 of begin to appear, object 2 and 3 are hidden.

 

activate it and simultaneously pressing right arrow key (key 205) hide the first object and the 2nd object is displayed

 

activate it and simultaneously pressing the left arrow key (key 203), the 2nd object disappears and the first object appears

In the above script is the part in green and the selected works.

 

but...

I would like after the 2nd object the 3rd (marked in red) Show .. then object 2 and 3 are displayed.

 

I hope it has come to understand.

I've already tried various but without success .. help would be greatly appreciated.

and sry fpr bad english

 

Greetings

cg1985

Link to comment
Share on other sites

Make one the enable parent of the other, and tick the 'set opposite state of parent' box (something like that, you will see it on the same tab. Then they can never both be enabled at the same time, and you only have to do the scripting for one reference.
Link to comment
Share on other sites

Hello.

 

I am not really sure I understand your question. I assume you want to create some kind of book or tome with three pages and you want the player to skim through it forward and backward by activating it while pressing a cursor key (left or right/forward or backward).

 

Is that right? If I am wrong, you can stop reading now and maybe try to explain your problem once more. :)

 

--

 

Create your activator objects, but instead of them all using the same script, you write a different (shorter) script for each one of them. SomePoseChapter01CoverRef is initially enabled, the other two are disabled.

 

The first object (SomePosesChapter01Cover) uses a script like this:

 

Begin OnActivate
If IsKeyPressed 205
	SomePosesChapter01Page001Ref.Enable 0
	Disable 0
EndIf
End

 

The second object (SomePosesChapter01Page001) uses a script like this:

 

Begin OnActivate
If IsKeyPressed 203
	SomePosesChapter01CoverRef.Enable 0
	Disable 0
ElseIf KeyPressed 205
	SomePosesChapter01Page002Ref.Enable 0
	Disable 0
EndIf
End

 

The third object (SomePosesChapter01Page002) uses this script:

 

Begin OnActivate
If IsKeyPressed 203
	SomePosesChapter01Page001Ref.Enable 0
	Disable 0
EndIf
End

 

So ... what is going on here? The first object is enabled. If it is activated while the right cursor key is pressed (“IsKeyPressed 205” returns true) the second object is enabled and the first object disables itself. Since the first object is now disabled, the script attached to it is now dormant.

Now the second object is enabled. If it is activated it will either enable the first object and disable itself (the left cursor key was pressed), enable the second object and disable itself (the right cursor key was pressed) or do nothing (no cursor key is pressed).

The third script should now be self explanatory ... if the third object is activated while the left cursor key is pressed, it enables the second object and disables itself.

 

Maybe this helps. Maybe I completely misunderstood the question. Anyway: Good luck.

Link to comment
Share on other sites

@ Tefnacht

first of all thank you for your help.

 

I assume you want to create some kind of book or tome with three pages and you want the player to skim through it forward and backward by activating it while pressing a cursor key (left or right/forward or backward).

 

yes thats right .. but in my case it is not a book, it's like a gallery ...

but the principle is the same.

 

your method is great .. but there is a small problem ... This gallery will have up to 170 pages, i.e. I had at the end then 170 scripts

 

that would be a bit too much.

 

can combine your method with the idea of Quetzlsacatanango (enable parent) somehow?

Link to comment
Share on other sites

so .. I try for hours and I've now done it ...

I have my own fault discovered

 

for those who are interested or who may use it here is my working script

 

scn SomePosesChapter01Script

Int SomePosesPage

BEGIN OnActivate

If SomePosesPage == 0
If SomePosesChapter01Page001Ref.GetDisabled && IsKeyPressed 205 == 1
	SomePosesChapter01CoverRef.Disable 0
	SomePosesChapter01Page001Ref.Enable 0
	set SomePosesPage to 1
EndIf

elseIf SomePosesPage == 1
If SomePosesChapter01Page002Ref.GetDisabled && IsKeyPressed 205 == 1
	SomePosesChapter01Page001Ref.Disable 0
	SomePosesChapter01Page002Ref.Enable 0
	set SomePosesPage to 2
elseIf SomePosesChapter01CoverRef.GetDisabled && IsKeyPressed 203 == 1
	SomePosesChapter01Page001Ref.Disable 0
	SomePosesChapter01CoverRef.Enable 0
	set SomePosesPage to 0
EndIf

elseIf SomePosesPage == 2
If SomePosesChapter01Page003Ref.GetDisabled && IsKeyPressed 205 == 1
	SomePosesChapter01Page002Ref.Disable 0
	SomePosesChapter01Page003Ref.Enable 0
	set SomePosesPage to 3
elseIf SomePosesChapter01CoverRef.GetDisabled && IsKeyPressed 203 == 1
	SomePosesChapter01Page002Ref.Disable 0
	SomePosesChapter01Page001Ref.Enable 0
	set SomePosesPage to 1
EndIf

EndIf	

END

 

maybe you could leave out the GetDisabled queries ... have not tried it without, but I let them in there ..

 

btw ... in this case you do not need enable parent :)

 

greetings

cg1985

Edited by cg1985
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...