FAQ Search
Memberlist Usergroups
Profile
  Forum Statistics Register
 Log in to check your private messages
Log in to check your private messages
Moonpod Homepage Starscape Information Mr. Robot Information Free Game Downloads Starscape Highscore Table
2 quick questions in editor
Post new topic   Reply to topic    Discussion Pod Forum Index -> Mr.Robot View previous topic :: View next topic  
 Author
Message
Zharmad



Joined: 25 Dec 2006
Posts: 95
Location: Sydney, Australia



PostPosted: Mon Dec 25, 2006 3:20 pm    Post subject: 2 quick questions in editor Reply with quote

Moving platforms begin in the 'active' state. What do I type into the initial state to stop it from moving when I enter the room?

Noting that water is rather special, so I was wondering how to target a body of water (I have the particular water-body named,) and make it rise and fall to different levels with various floor-switches as in some levels?
Back to top
View user's profile
Slyh



Joined: 25 Nov 2004
Posts: 480
Location: Karlsruhe, Germany



PostPosted: Mon Dec 25, 2006 7:46 pm    Post subject: Re: 2 quick questions in editor Reply with quote

Zharmad wrote:
Moving platforms begin in the 'active' state. What do I type into the initial state to stop it from moving when I enter the room?

"waiting"
(without the quotes)

Zharmad wrote:
Noting that water is rather special, so I was wondering how to target a body of water (I have the particular water-body named,) and make it rise and fall to different levels with various floor-switches as in some levels?

Try to set something like "water,8" as the target for the switch.
With lua-script use the global function "setWaterHeight(8)" to set the water height to 8.
Back to top
View user's profile
Zharmad



Joined: 25 Dec 2006
Posts: 95
Location: Sydney, Australia



PostPosted: Tue Dec 26, 2006 12:38 am    Post subject: Reply with quote

Thanks.
Hmm.. the water isn't doing anything with the target field... the switch does find the water body without a height specification.

Probably have to use a script; though I don't know how to call one from the game. Neutral
EDIT: "Make a lua script with the name 'room name'.lua and the game will automatically use it." > Now to learn .lua... .
Hey, how do I pass the state of the switch to the script?
Back to top
View user's profile
Slyh



Joined: 25 Nov 2004
Posts: 480
Location: Karlsruhe, Germany



PostPosted: Tue Dec 26, 2006 10:14 am    Post subject: Reply with quote

Zharmad wrote:
Thanks.
Hmm.. the water isn't doing anything with the target field...

Is the switch type "toggle"? Maybe that's relevant. (Didn't test it, though.)

Zharmad wrote:
the switch does find the water body without a height specification.

I don't know what you mean by this.


Zharmad wrote:
Probably have to use a script; though I don't know how to call one from the game. :|

Check out this message by Fost
http://www.moonpod.com/board/viewtopic.php?p=15175#15175

Basically you need the lua-file that has the same name as your room, for example "mycoolroom.lua".

The script needs a function "sequence()" as seen in Fost's message and a function "complete()". The last one is called whenever you return true from sequence(). This informs the game that the player finished the room. The function complete() can be used to set some data or activate stuff as soon as the room is finished.
sequence() has to return false as long as the room is not yet finished.

The function sequence() is called every time just before a (single) frame is rendered. To remember a state between two calls to sequence(), you have to use global variables.

LUA is very simple. You find lots of info using Google.

Zharmad wrote:
Hey, how do I pass the state of the switch to the script?

You don't. You check the current state of the switch in the script using the "sendMessage()"-function.

Example:
sendMessage("MyCoolSwitch", "SYSTEM", "IS_DOWN", "")

This will return true in case the switch is down and false in case it is not.
Back to top
View user's profile
Zharmad



Joined: 25 Dec 2006
Posts: 95
Location: Sydney, Australia



PostPosted: Tue Dec 26, 2006 8:29 pm    Post subject: Reply with quote

Yay, I have it!

It easier to script the thing so that the water height rises smoothly.

Thanks.
Back to top
View user's profile
colinvella



Joined: 15 Sep 2006
Posts: 82



PostPosted: Wed Jan 17, 2007 9:14 pm    Post subject: Reply with quote

I'm finally getting some scripting in and also managed to dig up an old command list containing the game functions integrated in lua.

The trouble is, the command list does not include a parameter signature for the commands, so I'm stuck

would anyone care to tell me how I can use 'closeDoor' to close the door on entry into a room? What follows is my tenative script:

Code:
-- 'STATE' DEFINITIONS
START = 0
AIRLOCK_CLOSING = 1

--SET UP GLOBAL VARIABLES
g_state = START

function sequence()

   if( g_state == START ) then

      -- start closing airlock
      closeDoor( 0 )

      g_state = AIRLOCK_CLOSING
      
   end

   return false
end


[edit] Those ASSERT messages are actually helpful given some Lua insight Smile

When calling openDoor with an integer only (I was assuming door id) I got an ASSERT that appeard to imply an integer and boolean parameters were required. After trying all permutations I fiugred out how the darned thing works:

openDoor( nId, bImmediatly)

first parameter is the door integer id
second parameter is a boolean: if true the door is closed without animation, if false it will close slowly with animation.. that's what i wanted!

maybe I can start to get the hang of this before the full manual is out...
Back to top
View user's profile
Fost
Pod Team
Pod Team


Joined: 14 Oct 2002
Posts: 3734



PostPosted: Wed Jan 17, 2007 9:34 pm    Post subject: Reply with quote

colinvella wrote:
maybe I can start to get the hang of this before the full manual is out...


I am amazed what people are managing so far. It certainly bodes well for what might be possible given some more docs. Smile
Back to top
View user's profile Visit poster's website
colinvella



Joined: 15 Sep 2006
Posts: 82



PostPosted: Wed Jan 17, 2007 10:18 pm    Post subject: Reply with quote

Fost,

Something on the lines of what functions are called and when (with parameter signature) would help. e.g. sequence() is called repeatedly every frame (?) until it returns true

and if you could provide the full command list with params and a short desc on each that would help a lot

btw.. I found scripting to be particularly convenient as it doesn't even require switching to the editor.. a quick room or waypoint refresh usually does the trick! Well done for your excellent design! I also think that having all your room layouts etc. defined as lua structured variables is a good idea as the game sticks to a unified format, even it results in bulky room config files.

If I may put forward a suggestion, it would help to have the game resume after a script error. At the moment, most errors result in the whole game crashing. Surely this must have slowed you guys down during development? Or did you work with a more lenient debug version?
Back to top
View user's profile
Fost
Pod Team
Pod Team


Joined: 14 Oct 2002
Posts: 3734



PostPosted: Wed Jan 17, 2007 11:17 pm    Post subject: Reply with quote

colinvella wrote:
Something on the lines of what functions are called and when (with parameter signature) would help. e.g. sequence() is called repeatedly every frame (?) until it returns true

Yes, don't worry all that is coming, we are just a bit snowed under so documentation is not currently getting the time it needs. Basically - the editor docs will not be considered finished until they are totally comprehensive and there is nothing left that anyone could ask for Smile

and if you could provide the full command list with params and a short desc on each that would help a lot

colinvella wrote:
it would help to have the game resume after a script error.

Debug versions have a script reloader which attempts to parse the script and allows you to reload it if it detects an error. Some scripting can crash it, but generally it's very quick to use. We didn't have a convenient way to include this without allowing the player to hit reload in the main game, but it may turn up in a future update if we add some flag in for user adventures to allow it.
Back to top
View user's profile Visit poster's website
Zharmad



Joined: 25 Dec 2006
Posts: 95
Location: Sydney, Australia



PostPosted: Tue Jan 23, 2007 10:55 pm    Post subject: Reply with quote

Hey, I've got the lua and config files for most of the rooms in the main game, and I've noticed that posting some of the more interesting scripts from particular rooms (e.g. where you save Raistlin, and where Orgus gives the player reduced gravity,) would help in showing what the lua scripts can do.

Do you think that's a good idea?
Back to top
View user's profile
Agrajag



Joined: 04 Aug 2006
Posts: 342



PostPosted: Wed Jan 24, 2007 12:33 am    Post subject: Reply with quote

Reduced gravity is something I want to put in my own game when I make it, so I'd be interested in seeing how to code it. Although I've more or less decided to wait until full documentation is released before seriously working on making a game, most of the stuff I want to do is too complicated without it.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Discussion Pod Forum Index -> Mr.Robot All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group