Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 01/01/09 03:01

A8D
Member
Registered: 12/06/08

BSL questions

Hello everyone (and happy new year smile ! (as for me, at midnight I was in the utter darkness because there was two power cuts in my region that lasted for several hours yesterday, because of bad weather. There were fallen trees on the road and there is lots of snow and so on =P)

I have some questions in BSL :

1) Is it not possible to make loops ? I saw that there are keywords that could have been used for this (every, for, iterate, repeat), but since nobody figured out how to use them ?

I thought it was maybe possible to do something like this :

func void my_loop () {
   var int count = 0
   some instructions...
   if (some condition) {
      break                         # but I see no such keyword
   }
   count = count + 1
   fork my_loop
}

2) Somehow related to the first question. Is it possible to periodically check for something. For instance, like at the end of Konoko's training, the game spawns ammo whenever you don't have any more. So I don't think that "if" is appropriate because it would check once, in the flow of the script. Is this only possible with "called from engine" functions ?

3) What is "dprint" for ?

4) How can I learn particles ?

5) Are trigger volumes defined in the binary data ?

6) Is "fork function_name" the only way to call a function ? Can't you just write the name of the function ?

I think that's all for now...

Last edited by A8D (01/01/09 03:01)


Where there's a will for Oni II, there's a way !

Offline

#2 01/01/09 05:01

Gumby
Member
From: Seattle, WA, USA
Registered: 08/30/07

Re: BSL questions

1)

var int break = 0;
func void my_loop () {
   var int count = 0;
   some instructions...
   if (some condition) {
      break                         # but I see no such keyword
   }
   count = count + 1
   fork my_loop
}func void my_loop () {
   var int count = 0
   some instructions...
   if (some condition) {
      break = 1;
   }
   count = count + 1;
   if (break eq 0) fork my_loop
}

2) That is done using a trigger volume. It calls up a function, which turns off the TV, checks for no ammo, then turns the TV back on again. It has sleep functions, so it takes about 2 seconds per loop.

3) Printing to the debug console

4) Asking more specific questions smile Practice, experimentation, practice. big_smile

5) Yep. BINACJBOTRGV. - http://wiki.oni2.net/User:Paradox-01/fo … s_.28TV.29

6) Yes.


Iritscen: roll
Iritscen: it's amazing this program even works
Gumby: i know
Iritscen: and that statement applies to my code, not just yours

Offline

#3 01/01/09 06:01

m2
Member
Registered: 01/22/07

Re: BSL questions

*#&§! Gumby was faster. However...

happy new year

dito

3) What is "dprint" for ?

To show the text on the screen (works only in dev-mode).

4) How can I learn particles ?

What do you mean? Create new particles?

5) Are trigger volumes defined in the binary data ?

Yes. http://wiki.oni2.net/OBD:BINA/OBJC/TRGV

6) Is "fork function_name" the only way to call a function ? Can't you just write the name of the function ?

You can just write the name of the function. The difference is that fork starts the function in a new thread. The forked function will be called while the "parent"-function is still running on. Without the fork the "parent"-function waits till the called function is finished and runs on after that.

Is it possible to periodically check for something. For instance, like at the end of Konoko's training, the game spawns ammo whenever you don't have any more. So I don't think that "if" is appropriate because it would check once, in the flow of the script. Is this only possible with "called from engine" functions ?

Yes. F.e.:

func void check(){
check instructions...
sleep 60
fork check
}

This function will be called now every second.

1) Is it not possible to make loops ?

I only know the way I showed above.

Last edited by m2 (01/01/09 06:01)

Offline

#4 01/01/09 06:01

A8D
Member
Registered: 12/06/08

Re: BSL questions

Thank you both for your answers smile

1/3/5/6) Understood !

2) What is the difference between the trigger volume method and m2's method (easier) ? I forget to tell that I had a look at the need_ammo function in the warehouse_train2.bsl file in the first level folder, but I don't understand why they use a trigger volume for that.

4) In fact I don't know where to start at all, how do they work... neutral

Last edited by A8D (01/01/09 06:01)


Where there's a will for Oni II, there's a way !

Offline

#5 01/01/09 06:01

m2
Member
Registered: 01/22/07

Re: BSL questions

2) What is the difference between the trigger volume method and m2's method (easier) ?

If you leave the trigger volume, Oni stops calling the function. "My" function checks forever.

4) In fact I don't know where to start at all, how do they work...

Particles are very complex:

http://wiki.oni2.net/OBD:BINA/PAR3 (used to create particles)
http://wiki.oni2.net/OBD:BINA/OBJC/PART (used to place the particles in the level)

Offline

#6 01/01/09 09:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: BSL questions

Offline

Board footer

Powered by FluxBB