Scripting Problems

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Scripting Problems
Lifecrafter
Member # 7538
Profile Homepage #0
I'm having some trouble with scripting. A couple of problems, at the moment. The first one is something that I've really been working around. I'll put a party in my scenario to check if there are script problems (which there often are) and it gives me an error message for a specific line. I'll quit and go check the script that it tells me to check, on the line it gives me. I count them and recount them, but for some reason, sometimes it's not accurate. I have to find the problem on my own. Then, just to make sure, I count what line it was on. Sure enough, it's not the one the game told me. I'm wondering if I'm just not counting the way it does.

The other problem is with variables. I tried to apply some in to the variables section of the dialogue script, the town script, and even the scenario script. When I put a party in, it says that the word I use is an unknown command.

Anyone know what to do?

[ Tuesday, October 10, 2006 15:20: Message edited by: Nemesis ]

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00
Off With Their Heads
Member # 4045
Profile Homepage #1
For the first, see Spiderweb's bugs page, particularly under "Some Words About Error Line Numbers," which is itself slightly misleading. BoA counts line numbers the way that BBEdit (for Mac) and Crimson Editor (for Windows) do, although the actual count can be buggy.

For the second, post a script and we can tell you what's wrong with it.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Agent
Member # 27
Profile #2
Usually an unknown command due to variables means that you didn't specify variables at the beginning of the script. You might want to check, just to make sure.

Example:
Begintownscript;

variables;
short one,two,three,four;

body;

etc...

Posts: 1233 | Registered: Wednesday, October 3 2001 07:00
Agent
Member # 5814
Profile #3
If you're having trouble pinpointing errors using line numbers, you can insert blank spaces into the script. These will move the error down.

So if you get an error on line 90, you can enter two blank spaces. If the error line doesn't change, the spaces were both after line 90. If the error line changed to 91, the error is between the two spaces. If the error line changed to 92, the error line is after both blank lines.

--------------------
quote:
Originally written by Kelandon
Well, I'm at least pretty

Posts: 1115 | Registered: Sunday, May 15 2005 07:00
Off With Their Heads
Member # 4045
Profile Homepage #4
By the way, Alint is one helpful addition to your debugging arsenal. I'm hosting it for Khoth.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
? Man, ? Amazing
Member # 5755
Profile #5
Furthermore, line numbers should be counted with "word wrap" disabled. The error line was a major headache before I figured that one out. In addition to Kel's editor suggestion, I've had good luck using Editpad Lite.

--------------------
quote:
Originally written by Kelandon:

Well, I'm at least pretty sure that Salmon is losing.


Posts: 4114 | Registered: Monday, April 25 2005 07:00
Guardian
Member # 6670
Profile Homepage #6
I used to use Editpad, but I've switched over to Programmer's Notepad 2 for everything code related, and I'm not going back. In my opinion, it's the next best thing after an AvernumScript IDE. Once they release the documentation for making schemes on the site, I'll make one for AvernumScript.

--------------------
IF I EVER BECOME AN EVIL OVERLORD:
All crones with the ability to prophesy will be given free facelifts, permanents, manicures, and Donna Karan wardrobes. That should pretty well destroy their credibility.
Posts: 1509 | Registered: Tuesday, January 10 2006 08:00
Lifecrafter
Member # 7538
Profile Homepage #7
Okay, the variables problem is solved, I think. At least, it's leaving me alone right now. Just to make sure, is the variable 'dam' one of those reserved for another purpose?

As for the line counts, well, I have to count them manually, because I'm using Simple Text for Mac. I'd get one of the text editors you guys recommended, but they won't run on my computer. (It's OS 9.1) So yeah, I basically need a new computer, or at least an upgrade eventually. Until then, things will just take forever and be inconvenient.

[ Friday, October 06, 2006 08:16: Message edited by: Nemesis ]

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00
Off With Their Heads
Member # 4045
Profile Homepage #8
BBEdit Lite is available in an OS9 version.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Lifecrafter
Member # 7538
Profile Homepage #9
Okay cool. Know where I can get it?

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00
? Man, ? Amazing
Member # 5755
Profile #10
This would be a good way to start looking....

--------------------
quote:
Originally written by Kelandon:

Well, I'm at least pretty sure that Salmon is losing.


Posts: 4114 | Registered: Monday, April 25 2005 07:00
Lifecrafter
Member # 7538
Profile Homepage #11
Oh right… thanks.

Anyway… yeah, more questions, because I'm just so clueless. The first one is about animated graphics. I've got custom terrain design down, but when I put animated graphics in the scenario (even premade graphics) they don't move.

The other question might be more complicated. I'm trying to initialize custom special abilities. I feel like I have it down, except for one problem: the button doesn't appear in the special abilities window.

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00
Lifecrafter
Member # 6193
Profile Homepage #12
After you've initialized a special ability you have to make sure to give the ability to the party. Use:
change_custom_abil_uses(char,ability,ammount);

As for terrain animation, make sure you've properly defined the terrain and make sure the sheet its on is properly set up.
quote:
From the BoA Editor Docs:
te_anim_steps - Lets you set this terrain type to be animated. if left at 0 or 1, no effect. If greater than 1, when drawing this terrain type, the icon cycles between its base icon (set above) and the te_anim_steps next icons in the sheet. (Example: If the terrain type’s set icon in the sheet is 5 and te_anim_steps is 4, the game alternates between icons 5, 6, 7, and 8 to draw the terrain.)
Note that, if the terrain type has a cutaway view or second icon (or both), you need to provide animation frames for them too.

I can't imagine what else could be the problem.

[ Saturday, October 07, 2006 17:19: Message edited by: Lazarus. ]

--------------------
Guaranteed to blow your mind.

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00
Infiltrator
Member # 3040
Profile #13
Also, if the speed is set to "fast" in the preferences, animated terrain won't be animated.

--------------------
5.0.1.0.0.0.0.1.0...
Posts: 508 | Registered: Thursday, May 29 2003 07:00
Lifecrafter
Member # 7538
Profile Homepage #14
Alright then, if I want to give the ability at the beginning of the scenario, where do I put change_custom_abil_uses? I've tried putting it in LOAD_STATE, START_STATE, and START_SCEN_STATE, as well as in the numbered state where I defined the ability. I still can't figure out how to get it to work.

[ Sunday, October 08, 2006 13:36: Message edited by: Nemesis ]

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00
Off With Their Heads
Member # 4045
Profile Homepage #15
quote:
Originally written by Nemesis:

Alright then, if I want to give the ability at the beginning of the scenario, where do I put change_custom_abil_uses? I've tried putting it in LOAD_STATE, START_STATE, and START_SCEN_STATE
START_SCEN_STATE is the one you want. Look at Bahssikava (among others) for an example of this.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Lifecrafter
Member # 7538
Profile Homepage #16
I've been using Bahssikava and Canopy as references for it, but sometimes I have trouble discerning between the stuff that I need and the stuff that I don't.

If it helps, I can post the codes I've tried writing out…

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00
Off With Their Heads
Member # 4045
Profile Homepage #17
Yeah, post the code. It's just about impossible to debug otherwise.

Bear in mind that you have to give the special ability to everyone if you want everyone to be able to use it.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Lifecrafter
Member # 7538
Profile Homepage #18
Alright, here it is. Warning: May contain cheater tips, for if I should ever finish the scenario.

// SCENARIO SCRIPT

// This is the special script for your entire scenario. It contains
// special encounters and code accessable from anywhere in the scenario. it also
// contains the code that initializes important special things in the
// scenario (like shops and names and descriptions of special items).

// You can create your own states, but you should give all of them numbers greater than
// or equal to 10.

beginscenarioscript;

variables;

int i,j,k,lvl,choice,gamble,user;

body;

// This is the state that is called every time the scenario is loaded,
// even when a save file in the scenario is loaded. Some things that should go here:
// Names and descriptions of special items.
// Names and effects of custom special abilities.
beginstate LOAD_SCEN_STATE;

//SPECIAL ABILITIES
init_special_abil(0,"Invoke Spell",12);

break;

// This is the state that is called only once at the very beginning of
// the scenario. Some things that should go here:
// The stuff in shops.
// Creating horses and boats.
beginstate START_SCEN_STATE;

//SHOPS
// Shop 0 - armor
add_item_to_shop(0,25,25);
add_item_to_shop(0,26,20);
add_item_to_shop(0,30,20);
add_item_to_shop(0,31,10);
add_item_to_shop(0,35,10);
add_item_to_shop(0,121,15);
add_item_to_shop(0,122,15);
add_item_to_shop(0,126,3);
add_item_to_shop(0,131,2);
add_item_to_shop(0,111,15);
add_item_to_shop(0,16,10);
add_item_to_shop(0,136,10);
add_item_to_shop(0,137,10);
add_item_to_shop(0,141,5);

// Shop 1 - weapons
add_item_to_shop(1,45,25);
add_item_to_shop(1,46,20);
add_item_to_shop(1,50,15);
add_item_to_shop(1,51,10);
add_item_to_shop(1,55,5);
add_item_to_shop(1,65,20);
add_item_to_shop(1,66,10);
add_item_to_shop(1,70,5);

// Shop 2 - tools
add_item_to_shop(2,170,500);
add_item_to_shop(2,171,500);
add_item_to_shop(2,172,30);
add_item_to_shop(2,174,500);
add_item_to_shop(2,164,500);
add_item_to_shop(2,177,500);

// Shop 3 - missiles
add_item_to_shop(3,85,500);
add_item_to_shop(3,86,10);
add_item_to_shop(3,90,10);
add_item_to_shop(3,95,3);
add_item_to_shop(3,100,20);
add_item_to_shop(3,101,10);
add_item_to_shop(3,105,10);

// Shop 4 - potions
add_item_to_shop(4,220,4);
add_item_to_shop(4,221,3);
add_item_to_shop(4,222,3);
add_item_to_shop(4,223,2);

// Shop 5 - food
add_item_to_shop(5,4,500);
add_item_to_shop(5,6,500);
add_item_to_shop(5,7,500);
add_item_to_shop(5,10,500);
add_item_to_shop(5,11,500);
add_item_to_shop(5,12,500);

// Shop 6 - Pronto
add_item_to_shop(6,101,500)
add_item_to_shop(6,102,500)
add_item_to_shop(6,106,500)
add_item_to_shop(6,107,500)
add_item_to_shop(6,109,500)
add_item_to_shop(6,175,500)
add_item_to_shop(6,178,500)
add_item_to_shop(6,220,500)
add_item_to_shop(6,221,500)
add_item_to_shop(6,223,500)
add_item_to_shop(6,241,500)

//BOATS
create_boat(0,1,4,17,0)
create_boat(1,1,4,13,1)
create_boat(2,1,11,4,1)

change_custom_abil_uses(0,0,1);
change_custom_abil_uses(1,0,1);
change_custom_abil_uses(2,0,1);
change_custom_abil_uses(3,0,1);

break;

// This state is called every tick wherever the party is in the scenario.
// You can use the set_state
beginstate START_STATE;

break;

// Place your own states below. Give each a number at least 10.
beginstate 10;//leave
break;

beginstate 11;//exit scen
break;

beginstate 12;//invoke spell
change_custom_abil_uses(who_used_custom_abil(),0,1);
get_text_response("What spell do you want to invoke?");

check_text_response_match("Faux Pas");
if (got_text_match()) {
run_animation_sound(113);
begin_shop_mode("Faux Pas","This convenient little shop just showed up when you called. However, convenience comes with a price.",5,6,-1);
end();
}

check_text_response_match("Pronto");
if (got_text_match()) {
run_animation_sound(113);
begin_shop_mode("Pronto","This convenient little shop just showed up when you called. However, convenience comes with a price.",6,6,0);
end();
}

check_text_response_match("Kiss Me");
if (got_text_match()) {
run_animation_sound(35);
force_status_nearby(250,1,8,1);//charm adjacent enemies
print_str_color("How sweet.",3);
end();
}

check_text_response_match("Gamble");
if (got_text_match()) {
gamble = get_ran(1,-1000,1000);
change_coins(gamble);
if gamble > 0 {
run_animation_sound(39);
print_str_color("You gain some coins.",4);
end();
}
if gamble < 0 {
run_animation_sound(38);
print_str_color("You lose some coins.",4);
end();
}
if gamble == 0
print_str_color("You don't gain or lose anything.",4);
end();
}

check_text_response_match("Psycheup");
if (got_text_match()) {
user = who_used_custom_abil();
if(get_energy(user) >= 50) {
change_char_energy(user,-50);
run_animation_sound(60);
put_sparkles_on_char(0,6,0);
put_sparkles_on_char(1,6,0);
put_sparkles_on_char(2,6,0);
put_sparkles_on_char(3,6,0);
set_party_status(1,255,0);
set_party_status(2,255,0);
set_party_status(3,255,0);
set_party_status(5,255,0);
set_party_status(15,255,0);
set_party_status(16,255,0);
set_party_status(17,255,0);
set_party_status(22,255,0);
set_party_status(27,255,0);
print_str_color("Get PSYCHED!",2);
end();
}
else print_str_color("Not enough MP.",2);
end();
}
break;
Also, since I went ahead and posted the whole scenario script, I'm open to suggestions as far as recommended changes, whether it's because I did something else wrong and just don't know it yet (quite likely) or if I made anything cheap. Bear in mind, use of the custom ability "Invoke Spell" is based upon prior knowledge of the existance of the "magic words", so to speak. Just let me know if I'm being too cheap or whatever.

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

My website: Nemesis' Refuge
Posts: 743 | Registered: Friday, September 29 2006 07:00