Jump to content

Baby Steps


Balladeer
 Share

Recommended Posts

OK, back into attempting to put things together with scripts and running into problems. Just trying to set up some stairways for mobility so I can walk around my scenario and the states aren't being called.

 

I have made my town script 't2CAndreda2.txt' and placed it in the same folder as the rest of the stuff for the scenario. I have set Town Script in Town Details for town 2 to 't2CAndreda2' then I have the following code:

 

 

Code:
// TOWN SCRIPT// 	Town 2: Castle Andreda (lvl 2)begintownscript;variables;body;beginstate INIT_STATE;	set_name(8,"Queen Rachel");	set_name(9,"Ambassador Corella");	set_name(10,"Sir Bualington");	set_name(11,"Lady Hintaly");	set_name(12, "Samantha");break;beginstate EXIT_STATE;// Always called when the town is left.break;beginstate START_STATE;// Starting state of the town, called every turn until you change the state.break;(Bunch of other states I haven't tested yet.)beginstate 29;//east stairway to lvl1	block_entry(1);	move_to_new_town(1,49,17);break;beginstate 30;//west stairway to lvl1	block_entry(1);	move_to_new_town(1,15,17);break;beginstate 31;//north stairway to lvl3	block_entry(1);	move_to_new_town(3,32,15);break;beginstate 32;//south stairway to lvl3	block_entry(1);	move_to_new_town(3,32,49);break;

 

I have set nodes 29-32 on four stairway locations in the editor but in testing the party doesn't get moved to any new town when the set squares are stepped on.

 

What am I missing?

Link to comment
Share on other sites

I changed the start state to this:

 

Code:
beginstate START_STATE;// Starting state of the town, called every turn until you change the state.	if (get_flag(2,29) == 250)		end();	message_dialog("It's loading.","");	set_flag(2,29,250);break;

 

and tried it with a brand new party. Nothing happened.

 

I've triple checked my town details script spelling. It's the same as the name of the file.

 

 

Edit 2:or does it only go to 29... *attempts again*

Link to comment
Share on other sites

This laptop is Windows Vista. Would that make any difference?

 

All right, it might help if I actually paid attention to the errors that the game gives me... *facepalm*

 

Somewhere in that (bunch of states I haven't tested yet) are a couple of errors. I took them all out and it worked fine. Thanks for being a sounding board anyway.

Link to comment
Share on other sites

You have two options. You can either count through your scripts manually - I did this for a while, so it's possible, but it's a pain in the proverbial - or you can get a text editor with line numbers.

 

I use Crimson Editor (download here), though it's an older version than the one available here. It's very easy to use, has a spell-checker, and will even colour your text so that comments, strings and so on all stand out.

Link to comment
Share on other sites

In theory you shouldn't skip any lines when counting, no matter what. Early versions of the game used to count incorrectly, which caused problems, but I think that this has pretty much been fixed.

 

Definitely use an editor with line numbering, and a good editor should have a 'Jump to line' feature, both will make life much easier. Also, hadn't someone around here written a syntax coloring scheme for Crimson Editor? That would be quite useful as well.

Link to comment
Share on other sites

I did the manual counting thing for a while as well, it blows pretty hard. I switched to EditPad Lite, and then Notepad++. I'd highly recommend the later. Both have Go-to-line functions, but so should any halfway decent text editor.

 

And yeah, overlong lines generally mean the previous string was missing a quote or something. I think parenthesis and brackets give "unmatched" error messages, but of course those are still worth checking because it's easy enough to check and it's a common error.

Link to comment
Share on other sites

All scripts should be checked with the Alint program, which you can get from:

 

http://home.sanbrunocable.com/~tommywatts03/page/alint.exe.zip

 

It is a Command Prompt program, which must be run your MS-Dos Prompt program. Unless you have a Mac.

 

This is not perfect, see this post:

http://www.ironycentral.com/forum/ubbthreads.php?ubb=showflat&Number=53245&page=1

 

All the best BoA utility programs are made for Mac OS, you might actually want to get a Mac.

 

Edit:

You will need to manually copy and paste the Alint hyperlink into your address bar, then press Enter. This forum (or Internet Explorer?) is not recognizing it as a link.

 

Link to comment
Share on other sites

If you want to give the player a big block of text, you could do this:

 

Code:
reset_dialog(); add_dialog_str(0,"255 characters",0); //the first number is the string number//then goes the actual text//then the indentation (0 means no indent)add_dialog_str(1,"",0);... //as many more as you likerun_dialog(1); //this actually displays the text.
Link to comment
Share on other sites

Actually, when I was writing the Windows version of astring astring, I believe I found that 254 was the maximum allowed number of characters in a string, not 255 as documented. I'd have to verify. It's been a while, but I believe that my astring checks this. If it does, I sure don't want to touch that code to make it do so.

Link to comment
Share on other sites

Originally Posted By: Dintiradan
I believe I found that 254 was the maximum allowed number of characters in a string, not 255 as documented.
This could easily be the case if he used strings with a length byte rather than null-terminated strings. I know that all the pre-Carbon (and probably also Carbon) Mac GUI commands take length-byte strings due to the libraries originally being written in Pascal.
Link to comment
Share on other sites

Pascal strings could be the same length in the same space as a C string, for instance, a length byte could go up to 255 allowing for 255 characters to follow it, all within a 256 byte buffer. The Carbon Libraries use CFStrings, which almost certainly store their size completely separately from the string data.

 

Neither of these explains what Jeff did; he used C strings and just limited their length to be less than 255 characters.

 

If your curious about how the game does this, the editor code contains an old version of the code; take a look in EdParser.cpp at script_type::load_script(); it's by the comment that says "create string data".

Link to comment
Share on other sites

*smacks forehead* D'oh, of course Pascal strings could still be 255 characters long. I guess what he did was decide that the size limit for the strings would be 255 characters, and then declared a char[255] array, forgetting that one of those has to be a null character. Or something like that.

 

 

 

It sounds like the CFStrings are basically a wrapper for the earlier library's Pascal strings.

Link to comment
Share on other sites

The tricky part with that is that since the game doesn't used fixed width fonts you can fit different numbers of different letters into various spots. For instance 'i' takes up less width than 'w', so the amount of 'i's that will fit somewhere will be much higher than the number of 'w's. Also, I'm not sure that the font rendering is quite the same in the Macintosh and Windows versions, so testing each specific case as it comes up is about the only way to to be sure.

Link to comment
Share on other sites

  • 3 weeks later...

Is there a reason Jeff and many others only put ten terrain graphics on each sheet? The documentation makes it sound like you could put all of your terrain graphics on one sheet and all of the small icons on a second sheet and be done. Coming from BoE I prefer keeping as much together as possible. Is there any reason I shouldn't?

Link to comment
Share on other sites

You can put up to 100 terrain graphics in a sheet, but the row length must be exactly 10. (Otherwise, the game wouldn't know where to find an arbitrarily numbered graphic. Also, I believe 100 is the limit, but I haven't bothered to test going further.)

 

I prefer to try to group icons that belong together on the same sheet when possible, and use different sheets for things that aren't related. This makes it easier to work with going from the base art in my graphics editor to the sheets I put into the game.

 

So, you can lump things together if you want, but at some point you would need to split them up somewhat anyway, so why not do it sooner to aid organization?

Link to comment
Share on other sites

Originally Posted By: Jewelz
The documentation makes it sound like you could put all of your terrain graphics on one sheet and all of the small icons on a second sheet and be done.

That's correct. In fact, you can put the floor and terrain graphics in the same sheet.

Originally Posted By: Niemand
You can put up to 100 terrain graphics in a sheet, but the row length must be exactly 10. (Otherwise, the game wouldn't know where to find an arbitrarily numbered graphic. Also, I believe 100 is the limit, but I haven't bothered to test going further.)

You can go far past 100; one of my graphics sheets is approaching 150 icons, and it works just fine.

As for me, I prefer to keep all things of a certain sort together if possible, which is why G500 in my projects thus far tends to consist of every custom floor and terrain graphic in the scenario. Having to search through multiple graphics is a pain in the rear, to say the least.
Link to comment
Share on other sites

I've been working on the Vista laptop so I can have actual size icons if I want. But when editing I'd rather have just one file to open as opposed to many.

 

In other news, I'm pretty sure I'm not going to make the deadline... I haven't even gotten the Christmas tree up yet and the kids have been bugging me for a week.

Link to comment
Share on other sites

Originally Posted By: Jewelz
Is there a reason Jeff and many others only put ten terrain graphics on each sheet? The documentation makes it sound like you could put all of your terrain graphics on one sheet and all of the small icons on a second sheet and be done. Coming from BoE I prefer keeping as much together as possible. Is there any reason I shouldn't?
No. I'm putting 99% of my terrain graphics on a single sheet. I have a few other sheets for groups of related graphics (eg waterfalls, dirt roads) but most are on a single sheet.

Also, your map graphic sheets do not need to mirror your terrain graphic sheets, like the ones in the graphics files do.
Link to comment
Share on other sites

There are five book graphics already available, you just need to define them in your data file. The sheets and icon/inventory indexes are as follows:

 

; first

it_floor_which_sheet = 1026;

it_floor_which_icon = 0;

it_inventory_icon = 0;

; second

it_floor_which_sheet = 1026;

it_floor_which_icon = 1;

it_inventory_icon = 1;

; third

it_floor_which_sheet = 1026;

it_floor_which_icon = 2;

it_inventory_icon = 2;

; fourth

it_floor_which_sheet = 1026;

it_floor_which_icon = 3;

it_inventory_icon = 3;

; fifth

it_floor_which_sheet = 1032;

it_floor_which_icon = 0;

it_inventory_icon = 1;

 

I think Kelandon's custom object script includes these as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...