(Information and examples taken from the DroidScript documentation)
The GoToSleep method forces the screen to turn off and puts the device to sleep. This has the same effect as pressing the power button.
app.GoToSleep();
After using this function rotating the phone/tablet will have no effect on the app's orientation. To unlock the orientation call the function again using the orientation “Default”.
function OnStart() { app.GoToSleep(); }