BSL talk:Manual
Jump to navigation
Jump to search
Tested this code in bio lab. Loop stops after displaying "riddle 4" for no reason. Strange enough: somethingX isn't declared but the code doesn't crash. Riddle me that. =D --Paradox-01 16:37, 6 December 2009 (UTC)
var int riddle_counter = 0; func main { chr_wait_animtype 0 punch #dmsg "Second test in bio lab." BSL_chaos } func BSL_chaos { dmsg "hello?" riddle_counter = riddle_counter + 1; if (riddle_counter eq 1) { dmsg "[g.riddle 1]" } if (riddle_counter eq 2) { dmsg "[g.riddle 2]" } if (riddle_counter eq 3) { dmsg "[g.riddle 3]" } if (riddle_counter eq 4) { dmsg "[g.riddle 4]" } if (riddle_counter eq 5) { dmsg "[g.riddle 5]" #dmsg "[r.ends here in compound level]" } if (riddle_counter eq 6) { dmsg "[g.riddle 6]" } sleep 60 something2 = BSL_chaos iterate over something2 using somethingX }
- Wow, interesting. Although I don't think it matters that something2 and somethingX are undeclared, because BSL supports weak syntax. But why does it stop at 4? Hmm.... --Iritscen 17:21, 6 December 2009 (UTC)
- iterate doesn't really work, so I'm not suprised. :) Not sure about the riddle_counter thing. Does it still break when you use else if? BSL is goofy. :) Gumby 10:06, 7 December 2009 (UTC)
- Did you actually notice what paradox is doing here? riddle_counter is tracking how many times iterate works. So asking if riddle_counter works on its own is kinda silly ;-) Anyway, how sure are we that this is how iterate was meant to be used? I mean, it looks like you're setting an iterator to a function pointer or something, which is sort of weird for any language. Wouldn't iterate have been intended for use with arrays? It seems like all those deprecated keywords -- every, for, iterate, over, repeat, and using -- were meant for arrays. Now if only we knew how to make an array! --Iritscen 11:32, 7 December 2009 (UTC)
- O_o You are right. Two things to check: See what somethingX is at the end. Try setting SomethingX to a value first. Gumby 00:12, 8 December 2009 (UTC)
- iterate over something2 using 7
Line 43 Illegal token, got "7" expected "identifier"
Hm, whatever. I think the "right" one was ignored. See following... The messages stop appearing after the fourth time again. Any ideas? (Is my oni sick or what?) --Paradox-01 07:09, 8 December 2009 (UTC)
- iterate over something2 using 7
- O_o You are right. Two things to check: See what somethingX is at the end. Try setting SomethingX to a value first. Gumby 00:12, 8 December 2009 (UTC)
- Did you actually notice what paradox is doing here? riddle_counter is tracking how many times iterate works. So asking if riddle_counter works on its own is kinda silly ;-) Anyway, how sure are we that this is how iterate was meant to be used? I mean, it looks like you're setting an iterator to a function pointer or something, which is sort of weird for any language. Wouldn't iterate have been intended for use with arrays? It seems like all those deprecated keywords -- every, for, iterate, over, repeat, and using -- were meant for arrays. Now if only we knew how to make an array! --Iritscen 11:32, 7 December 2009 (UTC)
- iterate doesn't really work, so I'm not suprised. :) Not sure about the riddle_counter thing. Does it still break when you use else if? BSL is goofy. :) Gumby 10:06, 7 December 2009 (UTC)
var int riddle_counter = 0; func main { chr_wait_animtype 0 punch BSL_chaos } func BSL_chaos { riddle_counter = riddle_counter + 1; sleep 30 if (riddle_counter eq 1) { dmsg "[g.riddle 1]" } if (riddle_counter eq 2) { dmsg "[g.riddle 2]" } if (riddle_counter eq 3) { dmsg "[g.riddle 3]" } if (riddle_counter eq 4) { dmsg "[g.riddle 4]" } if (riddle_counter eq 5) { dmsg "[g.riddle 5]" } if (riddle_counter eq 6) { dmsg "[g.riddle 6]" } sleep 30 BSL_chaos }
- Okay, that must be a limitation of the function stack in BSL. If you put "fork BSL_chaos", it goes all the way to six. I had already tried "fork BSL_chaos" in the previous code, but it doesn't accept the keyword "fork" in that context. I guess I should have said something earlier, but I assumed for some reason that the execution stack was bigger than that, so I figured it was "iterate" that was limiting us somehow. Well, congrats on figuring out a way to use "iterate", although I still think it was meant for arrays. --Iritscen 23:19, 8 December 2009 (UTC)
- Ah ok, always fork... But I don't think we can use iterate already. "something2 = BSL_chaos; iterate over something2 using somethingX" didn't produce error messages but how can we set iterate variable to numbers? Using "var int somethingX = 3" failed. :| --Paradox-01 10:34, 9 December 2009 (UTC)
- Well normally an "iterate" command is used on an array. So if we could make an array, we might be able to say "iterate over theArray using somethingX", and on each runthrough, somethingX would be set to the next element in theArray. If they decided that arrays were not needed, or too much work to implement, they might have removed them from BSL. --Iritscen 11:29, 9 December 2009 (UTC)
- "if we could make an array" Maybe we need a new StNA file. --Paradox-01 21:59, 12 December 2009 (UTC)
- Eh, that's not really the same thing. We'd need to insert new code into the existing BSL code to add array functionality. Unless it's already lurking in the source and we just haven't figured out how to use it yet. --Iritscen 23:00, 12 December 2009 (UTC)
- "if we could make an array" Maybe we need a new StNA file. --Paradox-01 21:59, 12 December 2009 (UTC)
- Well normally an "iterate" command is used on an array. So if we could make an array, we might be able to say "iterate over theArray using somethingX", and on each runthrough, somethingX would be set to the next element in theArray. If they decided that arrays were not needed, or too much work to implement, they might have removed them from BSL. --Iritscen 11:29, 9 December 2009 (UTC)
- Ah ok, always fork... But I don't think we can use iterate already. "something2 = BSL_chaos; iterate over something2 using somethingX" didn't produce error messages but how can we set iterate variable to numbers? Using "var int somethingX = 3" failed. :| --Paradox-01 10:34, 9 December 2009 (UTC)
"The only conditional statement is "if", with an optional "else" follow-up."
You can also use 'else if' statements. Script 10k (talk) 12:00, 6 December 2015 (CET)
- Oh, thanks! For some reason I thought I had checked for that and found there to be no such feature in BSL. Interesting how Bungie never used "else" or "else if". --Iritscen (talk) 23:26, 6 December 2015 (CET)
I think I'm done with BSL:Manual and BSL:Introduction to the extent of my abilities, so if anyone wants to correct a mistake, or discuss an issue on a talk page, it's the right time to do so. --Iritscen (talk) 00:28, 7 December 2015 (CET)