Jump to content

[LE] Papyrus - How to script a "do nothing"?


Recommended Posts

Hi guys I have been wondering for a while now what if I wanted a script to check for something if its true and if it is do something else do nothing.

 

So for example this is how I would imagine it being:

Event OnActivate(ObjectReference akActionref)
If (akActionref == Game.GetPlayer())
	Debug.MessageBox("The player activated the activator.")
Else
	; do nothing?
EndIf
EndEvent 

Can I leave it blank or do I need to type something in there?

Edited by morogoth35
Link to comment
Share on other sites

Serious, it really depends of the entire script, and what your trying to achieve with it, but no you don't need to use ; comment

Event OnActivate(ObjectReference akActionref)
If (akActionref == Game.GetPlayer())
	Debug.MessageBox("The player activated the activator.")
Else
	; do nothing?
EndIf
EndEvent 

Event OnActivate(ObjectReference akActionref)

	If (akActionref == Game.GetPlayer())
		Debug.MessageBox("The player activated the activator.")
	EndIf
EndEvent 

they are exactly the same. Do the same thing

Link to comment
Share on other sites

I often write code of this structure:

    int iSlot = Array.Find(SearchObject)
    if iSlot < 0
    else
        ;stuff
    endif

It's equivalent to testing for >=, but I -- and this is a personal preference -- find it easier to parse and to extend. The important point is: if you have no lines of code, the compiler won't care and the script will in fact do nothing.

Edited by foamyesque
Link to comment
Share on other sites

  • Recently Browsing   0 members

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