Billybob-Mario wrote:
nXIII wrote:
Billybob-Mario wrote:
You can't do
Code:
mesages do: [v: self say: 'something' ]Because messages is an array of some sort, and they can't say things.
self is not the block; blocks don't modify the context to include themselves as "self"
self still refers to the spriteI fixed a few things, and it said that a pirimitave failed and stopped responding.
What's the context?
Which primitive failed?
What are the values of the temp variables?
Offline
[^ self say: 'lala']
delay waitMseconds: ()*1000
self sayNothing.
[^self say: 'part 2'
delay waitMseconds: ()*1000
self sayNothing.
That is what I would try.
Offline
nXIII wrote:
Billybob-Mario wrote:
nXIII wrote:
self is not the block; blocks don't modify the context to include themselves as "self"
self still refers to the spriteI fixed a few things, and it said that a pirimitave failed and stopped responding.
What's the context?
Which primitive failed?
What are the values of the temp variables?
I think that the primitive is primSignal:atMilliseconds:. It's primitive 136.
I don't know the others, because it isn't responding.
Offline
Billybob-Mario wrote:
nXIII wrote:
Billybob-Mario wrote:
I fixed a few things, and it said that a pirimitave failed and stopped responding.
What's the context?
Which primitive failed?
What are the values of the temp variables?I think that the primitive is primSignal:atMilliseconds:. It's primitive 136.
I don't know the others, because it isn't responding.
I would think you should do something like this:
| messages sum start ci cumL |
messages _ #(('Foo' 2) ('' 0.2) ('Bar' 3) ('Baz' 1)).
sum _ messages inject: 0 into: [:s :pair | s + pair second].
start _ Time millisecondClockValue.
ci _ 1.
cumL _ 0.
[start + sum > Time millisecondClockValue] whileTrue: [
start + cumL + (messages at: ci) second > Time millisecondClockValue ifTrue: [
self say: (messages at: ci) first.
] ifFalse: [
cumL _ cumL + (messages at: ci) first.
ci _ ci + 1.
].
].
instead of using delays.
Last edited by nXIII (2010-09-26 20:20:09)
Offline
nXIII wrote:
Billybob-Mario wrote:
nXIII wrote:
What's the context?
Which primitive failed?
What are the values of the temp variables?I think that the primitive is primSignal:atMilliseconds:. It's primitive 136.
I don't know the others, because it isn't responding.I would think you should do something like this:
| messages sum start ci cumL |
messages _ #(('Foo' 2) ('' 0.2) ('Bar' 3) ('Baz' 1)).
sum _ messages inject: 0 into: [:s :pair | s + pair second].
start _ Time millisecondClockValue.
ci _ 1.
cumL _ 0.
[start + sum > Time millisecondClockValue] whileTrue: [
start + cumL + (messages at: ci) second > Time millisecondClockValue ifTrue: [
self say: (messages at: ci) first.
] ifFalse: [
cumL _ cumL + (messages at: ci) first.
ci _ ci + 1.
].
].instead of using delays.
It just says the first one.
Offline
nXIII wrote:
Billybob-Mario wrote:
It just says the first one.
SO GO DEBUG IT FOR YOURSELF! OH MY GOSH!
Seriously...
Pretty much every old person ever wrote:
If you don't have anything nice to say, don't say anything at all.
Offline
Yes, but debug it yourself. It can't be that hard.
Offline
Here:
| tosay waitTime time1 time2 time3 timeto length index say timee |
tosay := {'hi'.'hello'} as: OrderedCollection.
waitTime := {'1'.'2'} as: OrderedCollection.
length_ tosay size.
waitTime size < length
ifTrue: [
length_ waitTime size.
].
length _ length asNumber.
index_ 0.
index_ index asNumber.
length timesRepeat: [
index_ index + 1.
say_ tosay at: index.
say_ say asString.
timee_ waitTime at: index.
timee_ timee asNumber.
self say: say.
time3_ 0.
time1_ self timer.
timeto_ time1 + timee.
[ time1 < timeto ]
whileTrue: [
time2_ self timer.
time2 < time1
ifTrue: [
time3_ time1.
].
time1_ time3 + time2.
].
].
self say: ''.
tosay := {'hi'.'hello'} as: OrderedCollection.
waitTime := {'1'.'2'} as: OrderedCollection.
They are you say things.
Last edited by johnnydean1 (2010-09-28 12:43:35)
Offline
johnnydean1 wrote:
Here:
| tosay waitTime time1 time2 time3 timeto length index say timee |
tosay := {'hi'.'hello'} as: OrderedCollection.
waitTime := {'1'.'2'} as: OrderedCollection.
length_ tosay size.
waitTime size < length
ifTrue: [
length_ waitTime size.
].
length _ length asNumber.
index_ 0.
index_ index asNumber.
length timesRepeat: [
index_ index + 1.
say_ tosay at: index.
say_ say asString.
timee_ waitTime at: index.
timee_ timee asNumber.
self say: say.
time3_ 0.
time1_ self timer.
timeto_ time1 + timee.
[ time1 < timeto ]
whileTrue: [
time2_ self timer.
time2 < time1
ifTrue: [
time3_ time1.
].
time1_ time3 + time2.
].
].
self say: ''.tosay := {'hi'.'hello'} as: OrderedCollection.
waitTime := {'1'.'2'} as: OrderedCollection.
They are you say things.
It works! Thank you.
Offline