Easygoing Eyebeast Thralni Posted January 5, 2006 Share Posted January 5, 2006 So it took about two hours, not one, since my last question was solved. Again I'm dumping a problem on your plates. the code below has a small problem: Code: // flaglever.txt// version 1.0.0// by Thralni// You can alway use this script freely, but put my name (Thralni) in the acknowledgements.// flaglever.txt - completely changed version of doorlever.txt. Similair to my selfmade walllever.txt.// With this version you have to ALWAYS set a SDF (otherwise it wouldn't work), which gets set to 1 when you pull the lever. Also, a terrain at a certain// spot turns into a terrain of your choice. This script is needed when you would want to pull a lever, but a certain thing has to be done first.// Memory Cells - // 0,1 - The coordinates of a SDF. If that SDF is 1, will do everything in the script, if it is 0 does nothing.// 2,3 - The x,y coordinates of a terrain this lever replaces by a terrain number defined in memory cell 4. If both are left at 0, doesn't// do anything.// 4 - the terrain of location (memory cells 0 and 1) to change in.// 5 - a sound to be played// 6,7 - Coordinates for a stuff done flag. If these are 0 and 0, ignored. Otherwise,// when the lever is pulled, if the stuff done flag is 0, it becomes 1, and if the flag// is non-zero, it becomes 0.// If a flag is assigned here and is set to when, when the party enters this town later,// this script will open the gates.// NOTE: be sure to not use flags 299,0 - 299,29. These are used by this script!beginterrainscript; variables;short choice,terr,flag,x; body;beginstate INIT_STATE;break;beginstate START_STATE;break;beginstate SEARCH_STATE;break;beginstate STEP_INTO_SPOT_STATE;reset_dialog();add_dialog_str(0,"This lever is big and made of steel. would you like to pull it and see what it does?",0);add_dialog_choice(0,"Leave it");add_dialog_choice(1,"Pull and see what happens");choice = run_dialog(0);if (choice == 1) end();if ((get_memory_cell(0) > 0) || (get_memory_cell(1) > 0)) if (get_flag(get_memory_cell(0),get_memory_cell(1)) == 1) { if ((get_memory_cell(2) > 0) || (get_memory_cell(3) > 0) || (get_memory_cell(4) > 0)) { terr = get_terrain(get_memory_cell(2),get_memory_cell(3)); flip_terrain(my_loc_x(),my_loc_y()); set_flag(299,28,terr / 256); set_flag(299,29,terr % 256); x = 0; while (x = 1) { if (flag >= 27) flag = 0; set_flag(299,flag,terr); flag = flag + 1; x = 1; } if ((get_memory_cell(6) > 0) || (get_memory_cell(7) > 0)) { if (get_flag(get_memory_cell(6),get_memory_cell(7)) == 0) { set_terrain(get_memory_cell(2),get_memory_cell(3),get_memory_cell(4)); play_sound(get_memory_cell(5)); set_flag(get_memory_cell(6),get_memory_cell(7),1); end(); } terr = get_flag(250,28) * 256 + get_flag(250,29); set_terrain(get_memory_cell(2),get_memory_cell(3),terr); play_sound(get_memory_cell(5)); set_flag(get_memory_cell(6),get_memory_cell(7),0); end(); } } } message_dialog("Apparently, you didn't do the right thing to be able to pull this lever. It stays tight in this position.","");break; It says "Bad term in expression in line 58." The the linbe where it says "terrain = get_terrain(get_memory_cell(2),get_memory_cell(3));" what is the bad term? i don't understand what the problem is, or is it again soemthing which is in another line, but the program gives me another line because the error occured later then it should have occured. EDIT: replaced code with newer version Link to comment Share on other sites More sharing options...
Easygoing Eyebeast *i Posted January 5, 2006 Share Posted January 5, 2006 Try using a different variable name than "terrain". This may be an internal variable the engine uses and it does not like that. Also, check to make sure the memory cells are set to sensical values. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted January 5, 2006 Author Share Posted January 5, 2006 I'll try that, but what do you mean with more sensical memory cell values? Link to comment Share on other sites More sharing options...
Garrulous Glaahk Xoid Posted January 5, 2006 Share Posted January 5, 2006 Sensical, i.e, making sense. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted January 5, 2006 Author Share Posted January 5, 2006 Yes, that I did understand, but how can't it make sense? for a SDF it can't be higher then 255, but a memory cell can be much higher then that, so, again: what do you mean? Link to comment Share on other sites More sharing options...
Unflappable Drayk John S Posted January 5, 2006 Share Posted January 5, 2006 For example, make sure that cells 2,3 actually correspond to a a location in the town. Link to comment Share on other sites More sharing options...
Magnificent Ornk Swimmin' Salmon Posted January 5, 2006 Share Posted January 5, 2006 Your failure message, toward the end, should be corrected to read. Code: It stays tight in this position. Just a little alpha testing for ya. *this message sponsored by the grammarian* Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted January 5, 2006 Author Share Posted January 5, 2006 Quote: Originally written by Notty:For example, make sure that cells 2,3 actually correspond to a a location in the town. That is something that isn't wrong in the script then, but it is something you do wrong while designing with the editor. I can assure you that is something I do without mistakes. Thanks, salmon. extra help is always welcome. EDIT: it still doesn't work Link to comment Share on other sites More sharing options...
Kyshakk Koan KernelKnowledge12 Posted January 5, 2006 Share Posted January 5, 2006 I don't know if this is it, but you seem to be missing a parentheses on line 55. (Where you call get_flag.) Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Lilith Posted January 5, 2006 Share Posted January 5, 2006 He's right. That line should read: if (get_flag(get_memory_cell(0),get_memory_cell(1)) == 1) { That could easily be causing an error that's reported as being in line 58; BoA isn't good at working out the line number of an error due to a missing right parenthesis. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted January 10, 2006 Author Share Posted January 10, 2006 It works now, at least a part of it. the problem moved now to line 67, and it gives the same error. I checked all parenthesis's (if that's the way you spell it) and they seem okay. What could it be this time? Link to comment Share on other sites More sharing options...
Kyshakk Koan KernelKnowledge12 Posted January 10, 2006 Share Posted January 10, 2006 Try changing the name of the flag variable. Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted January 10, 2006 Share Posted January 10, 2006 I love Alint. It tells me that the real problem is in line 64. Your "while (x = 1) {" should read instead "while (x == 1) {". Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted January 11, 2006 Author Share Posted January 11, 2006 Thanks, kelandon. I'll test it later. it would have been nice if I could use Alint to, but I keep not understanding it, which keeps preventing me from succeding in checking files, whih keeps making me irritated, which keeps... I'll stop here. EDIT: it works, Thanks kelandon Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted January 11, 2006 Share Posted January 11, 2006 Thralni: Did you try following the step-by-step instructions that CPeters posted? Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted January 12, 2006 Author Share Posted January 12, 2006 Yes, I did, but got irritated when I didn't succeed. maybe I should try it again... Link to comment Share on other sites More sharing options...
Recommended Posts