Jump to content

Script runs out of order?


larryrathbun

Recommended Posts

Hello all,

 

I am working on a basic mod and am making a basic activator script.

 

I have tried many times, looked at tutorials and every time nothing works. It never crashes, it just doesn't do anything.

 

I decided I must be missing something, so inserted some debug message boxes to show me where the script broke. Still nothing, so I deactivate everything except the message boxes, figuring I will rebuild the script one layer at a time until I figure it out. (This is how I learn, very hands on.)

 

Simple right? I go pull the lever and the message boxes display out of order!

 

1, 2, 4, 5, 3. So I DELETE everything except the message boxes. Same result. Any ideas why?

Scriptname AAMuseumSimpleEnableTest extends ObjectReference  
  {Simple Activator Script for Basic Testing.
  Enables and Disables Objects.}

Actor Property PlayerREF Auto
ObjectReference Property TestLinkedRef Auto

Event OnActivate(ObjectReference akActionRef)

	Debug.MessageBox("1. Begin the test player next.")

	Debug.MessageBox("2. You are the player.")

	Debug.MessageBox("3. Test the wall here.")

	Debug.MessageBox("4. Outside the disable test if.")

	Debug.MessageBox("5. About to end.")

EndEvent

Thanks in advance...

 

 

Link to comment
Share on other sites

Sjogga,

 

Thanks for the reply. I wasn't in much of a scripty mood last night so I didn't work on it.

 

I suspected it might not be out of order, but was just messing up on the multiple message boxes. I removed # 3 and then #4 started doing it.

 

I used the message boxes originally because my script was just dropping out and I was trying to determine where, but debug.trace is probably a better way...

 

Thanks again.

Link to comment
Share on other sites

That was a possibility, thanks for the confirmation.

 

I sat down with it and got it working. Strangely my problem was coming with the line:

Actor Property PlayerREF Auto

Event OnActivate(ObjectReference akActionRef)
	if akActionRef == PlayerREF   ;this line here was simply not working, never registered true

I finally gave up and tried

Event OnActivate(ObjectReference akActionRef)
	If akActionRef == Game.GetPlayer()  ;using this method worked fine

That was the issue. Was making my head hurt because as far as I know it should work either way and it is amazingly simple.

Link to comment
Share on other sites

I did not fill in the property.

 

I got the impression from the tutorials I read that PlayerRef was a hardcoded, always available reference. That it was always the player and couldn't be assigned to anything else...

 

That would explain it. I was right, it was amazingly simple...

Link to comment
Share on other sites

  • Recently Browsing   0 members

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