Bos to Lua conversion page

Bos to Lua conversion page

Resources to get you going on your new project, or to help you over some emergent problems during your development cycle.

Moderator: Moderators

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Bos to Lua conversion page

Post by CarRepairer »

Use at your own risk.

Disclaimer:

Don't use Lua scripts unless you know what you're doing.
Lua scripts may run slower than Cob scripts.
Lua scripts may behave differently from Cob scripts.
Lua scripts may not be fully functional.
The Bos to Lua conversion page is incomplete.
The Bos to Lua conversion page will not fully convert your code.
The Bos to Lua conversion page can and will create bad code.
Using a low level hierarchy to parse a higher level hierarchy is not correct.
Do not look directly at the Bos to Lua conversion page.
The Bos to Lua conversion page is your only friend.
Last edited by CarRepairer on 12 Feb 2013, 09:13, edited 1 time in total.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Bos to Lua conversion page

Post by Argh »

That is pretty nifty. One question, though- I thought that Lua didn't handle move / turn / spin the same way as BOS. Has that been fixed? I see the numbers are the same, so I'm presuming yes.

I don't see anything else that's really sticking out there that can't be addressed with minor bug-fixes (on the modder's part, and gee, we only have to do it once).
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Bos to Lua conversion page

Post by Google_Frog »

Do not look directly at the Bos to Lua conversion page.
Oops I didn't read the disclaimer, how many hours do I have left to live?

How easy would a batch bos -> lua conversion page be to create?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Bos to Lua conversion page

Post by Argh »

Hmm. Needs to handle long lines. Quotes cause major problems.

And includes don't get converted.

None of this is the end of the world, just noting bugs.
Last edited by Argh on 29 Jun 2010, 10:18, edited 1 time in total.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Bos to Lua conversion page

Post by Google_Frog »

There;s a bug with function conversion
cob: CALL-SCRIPT scriptName();
lua: CALL-SCRIPT scriptName()

Functions should be localised by default. Also "get" in cob is could be converted to a lua function equivalent.

Another bug, local variables are still declared as "var myVariable" in lua instead of "local myVariable".
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Bos to Lua conversion page

Post by Google_Frog »

Another strange bug:
COB

Code: Select all

			turn rshoulder to x-axis <70> speed <135>;
			turn rshoulder to y-axis <15> speed <270>;
			turn rforearm to x-axis <-40> speed <270>;
			turn lshoulder to x-axis <-20> speed <135>;
			turn lshoulder to y-axis <-15> speed <270>;
			turn lforearm to x-axis <-40> speed <270>;
			Turn rshin to x-axis <85> speed<540>;	
			Turn rthigh to x-axis <-100> speed<270>;
			Turn lthigh to x-axis <30> speed<270>;
			Turn chest to y-axis <20> speed <90>;	
			wait-for-move hips along y-axis;		
			move hips to y-axis [1.2] speed <8400>;
			wait-for-move hips along y-axis;
			turn rshin to x-axis <10> speed <630>;
			move hips to y-axis [0] speed <8400>;
LUA

Code: Select all

			Turn( rshoulder , x_axis, math.rad(70), 135 )
			Turn( rshoulder , y_axis, math.rad(15), 270 )
			Turn( rforearm , x_axis, math.rad(-40), 270 )
			Turn( lshoulder , x_axis, math.rad(-20), 135 )
			Turn( lshoulder , y_axis, math.rad(-15), 270 )
			Turn( lforearm , x_axis, math.rad(-40), 270 )
			Turn rshin to x-axis <85> speed<540>	
			Turn rthigh to x-axis <-100> speed<270>
			Turn lthigh to x-axis <30> speed<270>
			Turn chest to y-axis <20> speed <90>	
			wait-for-move hips along y-axis		
			Move( hips , y_axis, 1.2 , 8400 )
			wait-for-move hips along y-axis
			Turn( rshin , x_axis, math.rad(10), 630 )
			Move( hips , y_axis, 0 , 8400 )
It may be due to a multi line piece definition when copied into the cob window.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Bos to Lua conversion page

Post by Argh »

math.rad should be localized as well. Or we need an equivalent to STANDARD_COMMANDS.h that is auto-included.

Oh, and...

Move( hips , y_axis, 1.2 , 8400 )

Will have some funny results ;)

If the move / turn / spin distance / radius / velocity is not enclosed in brackets, it's a raw number, and it needs to be converted to float by dividing by the correct constant for linear / angular.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Bos to Lua conversion page

Post by KDR_11k »

CarRepairer wrote:Do not look directly at the Bos to Lua conversion page.
Do not taunt the Bos to Lua conversion page.
The Bos to Lua conversion page may randomly accelerate to unsafe speed.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Bos to Lua conversion page

Post by Guessmyname »

Do not submerge the Bos to Lua conversion page in water, even partially.

Even if it doesn't give out a complete script, if it can get most of the leg work out of the way, I'm all for it.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Bos to Lua conversion page

Post by CarRepairer »

Yes, is it like Happy Fun Ball or the Aperture Science Portal device? Who knows?

Thanks for buggy examples, I'll try to fix them later today.

Edit:
Google_Frog wrote:There;s a bug with function conversion
cob: CALL-SCRIPT scriptName();
lua: CALL-SCRIPT scriptName()

Functions should be localised by default. Also "get" in cob is could be converted to a lua function equivalent.

Another bug, local variables are still declared as "var myVariable" in lua instead of "local myVariable".
Both these things (call-script and var) should work. If they are not working for you, paste me an example (like you did with your other post).
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: Bos to Lua conversion page

Post by KaiserJ »

do not feed the bos to lua conversion page after midnight.
the bos to lua conversion page is for enjoyment only and will not prevent pregnancy
wait at least 30 minutes after eating before using the bos to lua conversion page

edit:

if the bos to lua conversion page lasts longer than 4 hours, consult your physician
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Bos to Lua conversion page

Post by Guessmyname »

Do not reverse the polarity of the Bos to Lua conversion page.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Bos to Lua conversion page

Post by aegis »

Guessmyname wrote:Do not reverse the polarity of the Bos to Lua conversion page.
lua to bos D:
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Bos to Lua conversion page

Post by Pressure Line »

Do not insert metal objects into the bos to Lua conversion page.
User avatar
Hoi
Posts: 2917
Joined: 13 May 2008, 16:51

Re: Bos to Lua conversion page

Post by Hoi »

Do not press the red button on the bos to lua conversion page.
Do not use the bos to lua conversion page in the shower.
Warning: May contain small parts! Keep the bos to lua conversion page away from childern younger than 3 years.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Bos to Lua conversion page

Post by Guessmyname »

Do not drive under the influence of the Bos to Lua page.
Do not drive under the Bos to Lua page.
Do not allow the Bos to Lua page to drive.
Do not drive in the vicinity of the Bos to Lua page.
Do not expose cars to the Bos to Lua page.
Do not approach the Bos to Lua page in a vehicle.

If any of the above occur, call for help immediately.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Bos to Lua conversion page

Post by AF »

The Bos to Lua page is in no way affiliated to the production of lua . In the event that lua is outputted, the result is to be disregarded immediately.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Bos to Lua conversion page

Post by Pressure Line »

Do not attempt to stop the bos to Lua conversion page with hands, feet or genitals.
The bos to Lua conversion page is not designed for use as a flotation device.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Bos to Lua conversion page

Post by Forboding Angel »

Staring at the bos to Lua conversion page has been known in some rare cases to cause pregnancies. If you experience a burning sensation while using the bos to Lua conversion page, please stop usage immediately and consult your physician.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Bos to Lua conversion page

Post by raaar »

translation of the above:

bos -> lua conversion isn't fully functional.



...isn't it?
Post Reply

Return to “Game Development Tutorials & Resources”