Code center > Solved Bugs
runtime 6/compile error
PurpleYouko:
Not more than one fix.
Num's idea in the other thread is a work-around. It addresses the symptom without finding the root cause.
This fix here will stop the robots moving too fast in the first place so the other issue will never even arise.
Testlund:
So... These are not needed anymore?
if abs(rob(o).vx) > rob(o).MaxVel then rob(o).vx = sgn(rob(o).vx) * rob(o).MaxVel
if abs(rob(o).vy) > rob(o).MaxVel then rob(o).vy = sgn(rob(o).vy) * rob(o).MaxVel
I'll only change the robot code you mensioned here, is that it?
But the code that was there before I put the .maxwell codes in are gone, so I doubt it will work just like that. I think I need to download the sourcecode again and just add the latest solutions you've mensioned here. ..I guess. O, my...
Numsgil:
In 2.4 I believe I changed MaxVel to either a SimOpts member or a robot member and set it equal to 60 for all bots (since heavier bots now cost more to move... didn't seem right to limit their max velocity if they can output the energy to get there).
PurpleYouko:
Not only are these lines not needed. They are impossible
rob(o).MaxVel does not exist and will cause a crash as soon as you try to execute it.
Here is the original, unaltered code for the entire lookoccur routine.
--- Code: ---' copies the occurr array of a viewed robot
' in the ref* vars of the viewing one
Public Sub lookoccurr(n As Integer, o As Integer)
If rob(n).Corpse Then Exit Sub
Dim t As Byte
'If rob(n).lastviewed <> rob(o).AbsNum Then
For t = 1 To 8
rob(n).mem(occurrstart + t) = rob(o).occurr(t)
Next t
rob(n).lastviewed = rob(o).AbsNum
'End If
If rob(o).nrg < 32001 Then
rob(n).mem(occurrstart + 9) = rob(o).nrg
Else
rob(n).mem(occurrstart + 9) = 32000
End If
rob(n).mem(occurrstart + 10) = rob(o).age '.refage
rob(n).mem(in1) = rob(o).mem(out1)
rob(n).mem(in2) = rob(o).mem(out2)
rob(n).mem(711) = rob(o).mem(18) 'refaim
rob(n).mem(712) = rob(o).occurr(9) 'reftie
rob(n).mem(refshell) = rob(o).Shell
rob(n).mem(refbody) = rob(o).body
rob(n).mem(refypos) = rob(o).mem(217)
rob(n).mem(refxpos) = rob(o).mem(219)
'give reference variables from the bots frame of reference
rob(n).mem(refvelup) = (rob(o).vx * Cos(rob(n).aim) + rob(o).vy * Sin(rob(n).aim) * -1) - rob(n).mem(velup)
rob(n).mem(refveldn) = rob(n).mem(refvelup) * -1
rob(n).mem(refveldx) = (rob(o).vy * Cos(rob(n).aim) + rob(o).vx * Sin(rob(n).aim)) - rob(n).mem(veldx)
rob(n).mem(refvelsx) = rob(n).mem(refvelsx) * -1
rob(n).mem(refvelscalar) = Sqr(rob(n).mem(refvelup) ^ 2 + rob(n).mem(refveldx) ^ 2) ' how fast is this robot moving compared to me?
rob(n).mem(713) = rob(o).mem(827) 'refpoison. current value of poison. not poison commands
rob(n).mem(714) = rob(o).mem(825) 'refvenom (as with poison)
rob(n).mem(715) = rob(o).kills 'refkills
If rob(o).Multibot = True Then
rob(n).mem(refmulti) = 1
Else
rob(n).mem(refmulti) = 0
End If
If rob(n).mem(474) > 0 And rob(n).mem(474) <= 1000 Then 'readmem and memloc couple used to read a specified memory location of the target robot
rob(n).mem(473) = rob(o).mem(rob(n).mem(474))
'rob(n).mem(474) = 0
End If
If rob(o).Fixed Then 'reffixed. Tells if a viewed robot is fixed by .fixpos.
rob(n).mem(477) = 1
Else
rob(n).mem(477) = 0
End If
rob(n).mem(825) = rob(n).venom
rob(n).mem(827) = rob(n).poison
End Sub
--- End code ---
Note. In future when entering new lines of code, just comment out the old ones until you are sure you will never need them again. :D
Testlund:
Ok, I downloaded the sourcecode again and started over. I made the changes in the robots module as PY mensioned in this topic. After that I got the overflow again.
Code:
rob(n).mem(refvelup) = (rob(o).vx * Cos(rob(n).aim) + rob(o).vy * Sin(rob(n).aim) * -1) - rob(n).mem(velup)
This was supposed to have been fixed by making the changes in the robots module, right? Looks like that's not enough.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version