Author Topic: Run-time error 13 in 2.37.4  (Read 4790 times)

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Run-time error 13 in 2.37.4
« on: October 27, 2005, 12:36:07 PM »
While running a simulation I clicked on the icon for 'Starting new simulation' to enter the GUI. I just remembered it's a bug I've reported about before. I think the crash is caused if I have changed the mutation to anything higher than 1/1 on the mutations tab.

The code (located in the Optionsform window at line 764:

MutLab.Caption = (TmpOpts.MutCurrMult) + " X"

Hovering info:

Mutlab.Caption = "32X" (yeah, it was set at 32X now, but it doesn't matter if it is set at 2X or 8X for example)

Tmp.Opts.MutCurrMult = 32

This is where I should post this, right?
The internet is corrupt and controlled by criminally minded people.

Offline Ulciscor

  • Moderator
  • Bot Destroyer
  • *****
  • Posts: 401
    • View Profile
Run-time error 13 in 2.37.4
« Reply #1 on: October 27, 2005, 12:38:26 PM »
Yep right place  :D

Surely you want the concat operator to form the string for the caption? Isn't it

Code: [Select]
&and not

Code: [Select]
+?
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Run-time error 13 in 2.37.4
« Reply #2 on: October 27, 2005, 12:41:09 PM »
Umm... You mean I should change the + to & instead?
« Last Edit: October 27, 2005, 12:41:34 PM by Testlund »
The internet is corrupt and controlled by criminally minded people.

Offline Ulciscor

  • Moderator
  • Bot Destroyer
  • *****
  • Posts: 401
    • View Profile
Run-time error 13 in 2.37.4
« Reply #3 on: October 27, 2005, 12:44:11 PM »
I s'pose you could try it. I'm nowhere near as good as [Num] [PY] or [Bots] though so you might want to take advice from them not me  :P
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Run-time error 13 in 2.37.4
« Reply #4 on: October 27, 2005, 12:48:40 PM »
I guess you are right! No crashing anymore!  :boing: Let's just hope it doesn't affect how the mutation function work or anything.  :)
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Run-time error 13 in 2.37.4
« Reply #5 on: October 27, 2005, 12:50:45 PM »
In VB it is quite acceptable to directly add strings together using the + operator

It is in fact about two orders of magnitude faster than using &
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Run-time error 13 in 2.37.4
« Reply #6 on: October 27, 2005, 01:06:26 PM »
OK I just deliberately reproduced this bug in a running sim.

Anyone can do this by the following method.
  • Go into the GUI in a running sim and moving the mutations slider off center (any value)
  • click change to return to the simulation. Should run happily
  • Go back to the GUI options menu and the program will crash with a "type mismatch" error
  • Click Debug and it will take you to "DispSettings" in the "Optionsform" module. The highlighted line of code reads
    Code: [Select]
    MutLab.Caption = (TmpOpts.MutCurrMult) + " X"
  • The reason for this error is that Mutlab.Caption has to be a text value, TmpOpts.MutCurrMult is a numerical value and " X" is text. You can't just add them
  • Ulc's answer of substituting  "&" for "+" seems to work to fix this
  • My prefered fix is to turn the numerical value into a text then add them together like this.
    Code: [Select]
    MutLab.Caption = CStr(TmpOpts.MutCurrMult) + " X"
  • Once fixed you can hit the "play" button on the VB toolbar and the program will continue from where it left off.
This used to work fine so my belief is that the Cstr function was accidentally deleted at some point. This is reinforced by the fact that there are already brackets around the offending numerical value.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Run-time error 13 in 2.37.4
« Reply #7 on: October 27, 2005, 01:20:12 PM »
That worked too.  :)
The internet is corrupt and controlled by criminally minded people.