Jump to content


Photo

Code returning unrelated error


  • Please log in to reply
4 replies to this topic

#1 _259432

_259432

    GMC Member

  • GMC Member
  • 19 posts
  • Version:GM7

Posted 09 June 2012 - 07:30 PM

Hi again,
So anyway I have a piece of code for a IFS fractal generator in development that is intended to save all the global variables to a parameter file for reloading or sending. (There is also a save image code, but that works fine.) So here's my code:

message_alpha(.8)
message_text_font('Agency FB',12,c_black,1)
message_input_font('Agency FB',14,c_red,1)
action = show_message_ext('','Save','Load','')
if action = 1
{
    namestring = get_string('Parameter Filename','new_fractal')
    if show_question('Save Parameters?') = true
    {
        activefile = file_text_open_write('' + string(namestring) + '.par')
        file_text_write_string(activefile,'[Start IFS Generation Parameters]#' + string(global.direction[0]) + '#' + string(global.direction[1]) + '#' + string(global.direction[2]) + '#' + string(global.direction[3]) + '#' + string(global.direction[4]) + '#' + string(global.direction[5]) + '#' + string(global.direction[6]) + '#' + string(global.direction[7] + '#' + string(global.startpos) + '#' + string(global.translate[0]) + '#' + string(global.translate[1]) + '#' + string(global.color) + '#' + string(global.colorspeed) + '#' + string(global.maxiterations) + '#[End IFS Generation Parameters])
        file_text_close(activefile)
    }
}
if action = 2
{
    namestring = get_string('Parameter Filename','new_fractal')
    if show_question('Load Parameters') = true
    {
        exit *
    }
}
*This event has yet to be coded, but I'm not gonna bother if this bug can't be fixed.

All variable have been initialized, no worries. However, when I run the game, it returns this error:

___________________________________________
FATAL ERROR in
action number 1
of Mouse Event for Left Button
for object paramshot:

COMPILATION ERROR in code action
Error in code at line 17:
       namestring = get_string('Parameter Filename','new_fractal')

at position 31: Symbol , or ) expected.

As you can see, this error makes no sense. I tried deleting the block of code but I get the same error, only referencing position 1 of line 14. Why is this error coming up?

Edited by _259432, 09 June 2012 - 07:31 PM.

  • 0

#2 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 09 June 2012 - 07:37 PM

Hi again,
So anyway I have a piece of code for a IFS fractal generator in development that is intended to save all the global variables to a parameter file for reloading or sending. (There is also a save image code, but that works fine.) So here's my code:

message_alpha(.8)
message_text_font('Agency FB',12,c_black,1)
message_input_font('Agency FB',14,c_red,1)
action = show_message_ext('','Save','Load','')
if action = 1
{
    namestring = get_string('Parameter Filename','new_fractal')
    if show_question('Save Parameters?') = true
    {
        activefile = file_text_open_write('' + string(namestring) + '.par')
        file_text_write_string(activefile,'[Start IFS Generation Parameters]#' + string(global.direction[0]) + '#' + string(global.direction[1]) + '#' + string(global.direction[2]) + '#' + string(global.direction[3]) + '#' + string(global.direction[4]) + '#' + string(global.direction[5]) + '#' + string(global.direction[6]) + '#' + string(global.direction[7] + '#' + string(global.startpos) + '#' + string(global.translate[0]) + '#' + string(global.translate[1]) + '#' + string(global.color) + '#' + string(global.colorspeed) + '#' + string(global.maxiterations) + '#[End IFS Generation Parameters])
        file_text_close(activefile)
    }
}
if action = 2
{
    namestring = get_string('Parameter Filename','new_fractal')
    if show_question('Load Parameters') = true
    {
        exit *
    }
}
*This event has yet to be coded, but I'm not gonna bother if this bug can't be fixed.

All variable have been initialized, no worries. However, when I run the game, it returns this error:

___________________________________________
FATAL ERROR in
action number 1
of Mouse Event for Left Button
for object paramshot:

COMPILATION ERROR in code action
Error in code at line 17:
   	namestring = get_string('Parameter Filename','new_fractal')

at position 31: Symbol , or ) expected.

As you can see, this error makes no sense. I tried deleting the block of code but I get the same error, only referencing position 1 of line 14. Why is this error coming up?

it makes perfect sense!
it is just in the wrong place where the error is!:
see this line:
file_text_write_string(activefile,'[Start IFS Generation Parameters]#' + string(global.direction[0]) + '#' + string(global.direction[1]) + '#' + string(global.direction[2]) + '#' + string(global.direction[3]) + '#' + string(global.direction[4]) + '#' + string(global.direction[5]) + '#' + string(global.direction[6]) + '#' + string(global.direction[7] + '#' + string(global.startpos) + '#' + string(global.translate[0]) + '#' + string(global.translate[1]) + '#' + string(global.color) + '#' + string(global.colorspeed) + '#' + string(global.maxiterations) + '#[End IFS Generation Parameters])
before the last # there is no : ' for the string to stop it continues make the line like so:
file_text_write_string(activefile,'[Start IFS Generation Parameters]#' + string(global.direction[0]) + '#' + string(global.direction[1]) + '#' + string(global.direction[2]) + '#' + string(global.direction[3]) + '#' + string(global.direction[4]) + '#' + string(global.direction[5]) + '#' + string(global.direction[6]) + '#' + string(global.direction[7] + '#' + string(global.startpos) + '#' + string(global.translate[0]) + '#' + string(global.translate[1]) + '#' + string(global.color) + '#' + string(global.colorspeed) + '#' + string(global.maxiterations) + '#'/*you never finished the string for the # it stood like this: '# no ending '  making the rest of the code a string*/[End IFS Generation Parameters])

Edited by creators124, 09 June 2012 - 07:38 PM.

  • 0

#3 _259432

_259432

    GMC Member

  • GMC Member
  • 19 posts
  • Version:GM7

Posted 09 June 2012 - 07:42 PM

Yes! Thank you, I didn't even notice that! Will implement.
  • 0

#4 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 09 June 2012 - 07:45 PM

Yes! Thank you, I didn't even notice that! Will implement.

don't panic!
this community has your back! Posted Image
but yeah that turned a bunch of code into a string when the non-string code are supposed to be! xD
  • 0

#5 MetroidMan347

MetroidMan347

    GMC Member

  • GMC Member
  • 823 posts
  • Version:GM:Studio

Posted 10 June 2012 - 03:54 AM

Do you have color coding disabled? It's very helpful for distinguishing different parts of code such making strings blue (or whatever you set it to).
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users