scripting, scripting...

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, scripting...
Master
Member # 5977
Profile Homepage #0
This is very strange. The game doesn't seem to set a certain flag, and i can't understand why not. here is the code:

/ Control panel A

beginstate 22;
message_dialog(".","");
break;

beginstate 23;
if (get_flag(20,19) == 1) {
message_dialog(".","");
end();
}
set_flag(20,19,1);
message_dialog(".","");
break;

beginstate 24;
if (get_flag(20,19) == 0) {
message_dialog(".","");
end();
}
message_dialog(".","");
break;

beginstate 25;
if (get_flag(20,19) == 0) {
message_dialog(".","");
end();
}
if (get_flag(20,7) == 0) {
message_dialog(".");
end();
}
message_dialog(".","");
set_flag(20,8,1);
break;

beginstate 26;
if (get_flag(20,19) == 0) {
message_dialog(".","");
end();
}
if (get_flag(20,7) == 0) {
set_flag(20,7,1);
message_dialog(".","");
end();
}
set_flag(20,7,0);
message_dialog(".","");
break;

beginstate 27;
if (get_flag(20,19) == 0) {
message_dialog(".","");
end();
}
message_dialog(".","");
break;

beginstate 28;
if (get_flag(20,19) == 0) {
message_dialog(".","");
end();
}
set_flag(20,19,0);
message_dialog("","");
break;
Okay, i did some more testing and adjusted the script above. now, the strange thing is, that, whatever i do thefollowing things happen:

1) I press button 1, going to state 23. The state is working normally, but at the end returns to the screen where you choose a button to press, although i didn't give the game a command to do so!

2) You have to press button 1 again in order to set flag (20,19) to 1. I don't understand this at all.

3) now everything works almost fine.

EDIT: Strange. I decided to load another save file, and it all seems to work fine now...

[ Sunday, December 25, 2005 00:37: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #1
Are you posting the entire script? I don't see a section where the player actually chooses what button to push. Also, this seems a very cumbersome way of coding what you want. Of course, I would need to see your entire script before making too many judgments.

Please post:
1) The entire script.
2) A short description of what you are trying to do.

My guess would be that you forgot a reset_dialog() somewhere, but that's just a hunch.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #2
quote:
Originally written by Thralni, chicken god prophet:

EDIT: Strange. I decided to load another save file, and it all seems to work fine now...
When all else fails, reload/restart.... :P

By the way, I feel your pain. Debugging is a frustrating process.

[ Saturday, December 24, 2005 11:09: Message edited by: Kelandon ]

--------------------
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
Law Bringer
Member # 4153
Profile Homepage #3
Ouch, that stretches the screen.

1) I agree that it's probably a reset_dialog() problem.

2) Take out the end(); that's within the if-statement. That's what's keeping the state from getting to the set_flag() call before the second time through.

3) Funny how that works. Happened to me a lot as well.

--------------------
Gamble with Gaea, and she eats your dice.

I hate undead. I really, really, really, really hate undead. With a passion.
Posts: 4130 | Registered: Friday, March 26 2004 08:00
Master
Member # 5977
Profile Homepage #4
What i really find so strange is that it actually does work now. for about three hours i was getting irritated, mad, frustrated, and then that small moment of understanding came. i thought that, as i was working with a SDF that was probably already set at the moment I was bussy with the script, it may be good to restart with a save file in which i hadn't set that flag yet, and it all worked again.

it still doesn't really explain what was happening, because what should have happened (in my opinion) is this:

you push the "start system" button (button 1). This brings you to state 23. Flag (20,19) wasn't set to 1 yet, so it shouldn't look at the part between the brackets, but should immeditaly go to the part the comes after it. that's what it does, but for some reason, it didn't set the flag first time through. the second time only it did that. After that it worked like it should have.

By the way, now it all works fine, so the crisis is over, but for you *i, here is the hole script anyway.

beginstate 19;

large_draw_pic_dialog(550,"");
message_dialog("","");

get_text_response("Which button?");
check_text_response_match("none");
if (got_text_match()) {
set_state_continue(22);
}

check_text_response_match("1");
if (got_text_match()){
set_state_continue(23);
}

check_text_response_match("2");
if (got_text_match()) {
set_state_continue(24);
}

check_text_response_match("3");
if (got_text_match()) {
set_state_continue(25);
}

check_text_response_match("4");
if (got_text_match()) {
set_state_continue(26);
}

check_text_response_match("5");
if (got_text_match()) {
set_state_continue(27);
}

check_text_response_match("6");
if (got_text_match()) {
set_state_continue(28);
}
message_dialog("entered something wrong","");
set_state_continue(19);
this part above is where you choose a button. kelandon made it for me, s i wasn't sure about it. however, I had to change things in it to make it actually wrk, as kelandon used calls that the game didn't recognize. in other words: calls that don't exist in boA.

The part that containes the states to which the above script referres, is the state i posted above. note that that is the script that modified and is the newest version of that partcular script. That, in fact, is the script that now works. Therefor, chances are slim i'll change things in it. it works, after all.

EDIT: i forgot to say, *i, that this is my first scenario, so please, don't treat my scripts as if its supposed to be the work of the a designer like kelandon. I'm already proud that most of what I made actually already worked the first time through.

EDIT2: and another thing i wnted to mention was that its certainly not a case of reset_dialog();, for abvious reasons. I you just saw, there is no place i actually made a dialog box that way. Its all with message_dialog("","");

Is it still necessary to tell exactly what i want to do?

[ Sunday, December 25, 2005 00:51: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #5
Do you have the newest version of BoA? There were a few calls added in between that and there. My guess of reset_dialog() was based on the fact you had not provided all of the information. Had you supplied the script before, I would have had a different opinion.

One should always strive to have compact scripting. It makes it a lot easier to come back to in beta testing when things you do not anticipate pop up.

You can say what you want to do if you desire.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Shock Trooper
Member # 932
Profile #6
quote:
Originally written by Ephesos:

Ouch, that stretches the screen.
2) Take out the end(); that's within the if-statement. That's what's keeping the state from getting to the set_flag() call before the second time through.

@Ephesos:

If you are referring to the couple of if-statements that work like this:

if (get_flag(20,19) == 1) {
message_dialog(".","");
end();
}
set_flag(20,19,1);
message_dialog(".","");
Then you are wrong. If you are referring to the if-statements that work like this:

beginstate 25;
if (get_flag(20,19) == 0) {
message_dialog(".","");
end();
}
if (get_flag(20,7) == 0) {
message_dialog(".");
end();
}
message_dialog(".","");
set_flag(20,8,1);
break;
Then you might be right. If Thralni wanted to ensure that SDF 20,8 was only set to 1 when SDFs (20,19) and (20,7) were equal 0, then there is no problem with his code. It makes for fewer characters (and less processor work, too?) if he had of done it like:

beginstate 25;
if ((get_flag(20,19) == 0) && (get_flag(20,7) == 0)) {
set_flag(20,8,1);
}
message_dialog(".","");
break;
@Thralni: Your scripting is sloppy, and this being your first scenario is no excuse. Not trying to be mean, just honest.

It works nonetheless. If you want a decent excuse, try using the obvious one: you have little to no prior programming experience. (I'm certain that this is the case; in an earlier thread you were asking many, many, basic questions about variables. You seemed somewhat clueless.)

--------------------
Microsoft Patents Ones, Zeroes (March 25, 1998)
"Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu
Posts: 215 | Registered: Sunday, April 7 2002 08:00
Master
Member # 5977
Profile Homepage #7
Cpeters, you are absolutely right. I have indeed 0% prior experience with programming. It all works, so I'm quite happy already with what i achieved. I am as far that i manage to realize certain things, like a cash machine (darn! I actually didn't want to say that!), things like i showed in this thread, and some other small things. Anyhow, this is my first thing I do with programming. Maybe, could you show mr some improvements on this script? I don't say i'm going to use it, I just want to know how somebody else would do it.

EDIT: what you already showed: yes, i tried that once, but the game had problems with it, so i didn't do it a second time.

[ Sunday, December 25, 2005 09:34: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Law Bringer
Member # 4153
Profile Homepage #8
quote:
Originally written by CPeters:

@Ephesos:

If you are referring to the couple of if-statements that work like this:

if (get_flag(20,19) == 1) {
message_dialog(".","");
end();
}
set_flag(20,19,1);
message_dialog(".","");
Then you are wrong.

Whoops... that's what I get for mistaking "==" for "!=".

--------------------
Gamble with Gaea, and she eats your dice.

I hate undead. I really, really, really, really hate undead. With a passion.
Posts: 4130 | Registered: Friday, March 26 2004 08:00
Master
Member # 5977
Profile Homepage #9
Okay, another stupid question: what does != stand for? I learned in school what "!" stands for (I dont know how it is called in English), but I'm not sure its the same thing as here. basically, what i learedn in school, is that 9! = 9x8x7x6x5... etc.

[ Sunday, December 25, 2005 10:21: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Law Bringer
Member # 4153
Profile Homepage #10
!= means "not equal to".

It's indispensible when working with SDFs, in my humble opinion.

--------------------
Gamble with Gaea, and she eats your dice.

I hate undead. I really, really, really, really hate undead. With a passion.
Posts: 4130 | Registered: Friday, March 26 2004 08:00
Shock Trooper
Member # 932
Profile #11
quote:
Originally written by Thralni, chicken god prophet:

Maybe, could you show mr some improvements on this script?
[semi-rant]
Perhaps. You'd have to get over your irrational fear of someone stealing your idea - it either will happen or it won't. If you manage to come up with something that is truly unique, then people will notice if something similar comes along later, claiming to be an original idea.

It's not such a bad thing, as long as credit is given where credit is due. If somebody bases a script off my work and I get credit, then I have no problems with it. On a cursory inspection, your machinery/goop/vats idea seems geneforge-esque. But it may be based off the filth factory in Avernum 3, or... I could speculate for days. There are few truly original ideas any more.

It's not about where you get your inspiration from, it's about what you create from it. There have even been cases where two people have made the nearly the exact same creation as each other, and entirely independant of each other. Transistors are an example, IIRC.

It's hard to offer suggestions on your code as a whole, when I have no idea what your code, as a whole, does. No one is going to thieve your plot. They might thieve your code, then managle it, optimise it, and change what it does to the point where it no longer resembles your work, but they won't thieve your plot.
[/semi-rant]

quote:
Originally written by Thralni, chicken god prophet:

EDIT: what you already showed: yes, i tried that once, but the game had problems with it, so i didn't do it a second time.
Hmmm. Sorry. The == should have been !=
Revised, it looks like:

beginstate 25;
if ((get_flag(20,19) != 0) && (get_flag(20,7) != 0)) {
set_flag(20,8,1);
}
message_dialog(".","");
break;
Note to self: don't try to help people whilst operating on no sleep.

--------------------
Microsoft Patents Ones, Zeroes (March 25, 1998)
"Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu
Posts: 215 | Registered: Sunday, April 7 2002 08:00
The Establishment
Member # 6
Profile #12
Cash machines are hardly a new idea...been discussed ad nauseum for BoE a long time ago. If you want help on coding one, just ask.

I agree with the sentiment that you should not be afraid of people stealing your ideas. If your ideas have merit, people will use them. This is generally seen as a good thing and a source of pride to see your scripts being used in some form.

Now, worrying about not getting credit I can understand. However, over at the Lyceum we have something called the Codex for these situations. Follow the link in the header of this forum. Post your script there and it will be stored as long as the Lyceum lasts under your name.

Additionally, you can get suggestions there as to how to improve your coding skills as well as look at several examples to either give you inspiration or help with coding style. I encourage you to join up at the Lyceum, it has become underused as of late and would be nice if it would be the central hub for designing it once was.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Shock Trooper
Member # 932
Profile #13
quote:
Originally written by *i:

I encourage you to join up at the Lyceum, it has become underused as of late and would be nice if it would be the central hub for designing it once was.
Meh. I tried registering a couple of weeks back and had all sorts of problems. Even if someone offered to help, I just couldn't be stuffed now.

--------------------
Microsoft Patents Ones, Zeroes (March 25, 1998)
"Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu
Posts: 215 | Registered: Sunday, April 7 2002 08:00
Master
Member # 5977
Profile Homepage #14
Well, thanks for all your support. What i basically want to achieve, is to get to a point that many characters in ym scenario and also situations in which you are in, seem to be realistic or funny (that funny part is my sense of humor. others may find it boring). For example: isn't it plain stupid that you can just charge into the mayor's office? if it were in real life you would have been stopped and arrested! No. In my scenario, at least at one of the five major (friendly) towns, you have to make an appointment before proceeding. In the others I'll come up with something that you'll also need permission to get to see the mayor.

The creation vats you mean, Cpeters? that might be an influence of geneforge (although i hate the game) or I had a lack of ideas. The main point is that i wanted to do new things in scripting which i hadn't done before while making ym scenario, and this was one of those things.

Cpeters: That explains why the code didn't work when i tried it.

Ephesos: thanks. Another problem cleared for the future. now can somebody explein exactly how it works in script? I know, I'm not easily satisfied, but I want to get to the bottom of this scripting bussines, so in the future I'll have to ask less.

*i: I have no idea what people thought of in the BoE era, i really don't. Its quite easy to say that nothing I put in ym scenario is original, ebcause it was put in one of the 300 scenario's for BoE. I'll look at the Lyceum. I think I'm already registered there, but I didn't look really at the codex. And the cashmachine, I already made it. It has a nice place near the park of the province's capital in which the scenario plays.

if somebody wants to know more, feel free to PM me and ask what you want to ask. This granted you wont tell anything to others who don't seem interested, and be mild. As long as you don't see how I made the towns, its quite easy to say its a worthless idea. Once you see the town, a bad idea may turn out to be a good one after all.

EDIT: One small question: How do you write a variable ins cript? Until now i did it this way, and the game did not complain:

m = get_current_tick(); Is this allright?

[ Monday, December 26, 2005 00:40: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Shock Trooper
Member # 932
Profile #15
quote:
Originally written by Thralni, chicken god prophet:

Its quite easy to say that nothing I put in ym scenario is original, ebcause it was put in one of the 300 scenario's for BoE.
This is because there are few truly original ideas anymore. Could you imagine how a non carbon-based lifeform would work? Or a how technology would have evolved for humanity if we originated on Venus? Odds are, you will trawl through your memories, trying to find some form of reason or rhyme that fits the present situation best, and adapt it.

quote:
Originally written by Thralni, chicken god prophet:

EDIT: One small question: How do you write a variable ins cript? Until now i did it this way, and the game did not complain:
m = get_current_tick();Is this allright?

Perfectly alright. I've never heard of any high level programming language that doesn't fit the basic premise:
variable_name assignment_operator value_to_assign_variable

Just remember that you can declare strings as well as integers. And that you can use if-else statements in AvernumScript™. They can be very useful.

--------------------
Microsoft Patents Ones, Zeroes (March 25, 1998)
"Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu
Posts: 215 | Registered: Sunday, April 7 2002 08:00
Master
Member # 5977
Profile Homepage #16
Okay, thanks. I'm now going to see if the game really does what it should do. i had problems with variables already. if it wont work, i'll simply post the script here and see if one of you guys knows what the ailment is.

EDIT: Hmmm. Nope, it still doesn't work correctly. Now tell me. if a variable is set in one script, will it also be set in another variable? because what happens in the script i made, is that you make an appointment for the next day. In the scenario script I made two states, which tell you when you missed your appointment, and what day you have your appointment, as a reminder. the only problem is, that it seems asif the varible isn't set in that particular script, causing the game to immediatly say you missed your appointment. If its necessary, i'll also post the two scripts.

[ Monday, December 26, 2005 01:44: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Shock Trooper
Member # 932
Profile #17
quote:
Originally written by Thralni, chicken god prophet:

EDIT: Hmmm. Nope, it still doesn't work correctly. Now tell me. if a variable is set in one script, will it also be set in another variable?
If you are asking; "If I set foo = 1; In script A, will foo still be 1 in script B?", then the answer is no. sigh... you can't even had foo stay equal to 1 when you exit and reenter a town.

To use the terminology that I gained from another language: all variables are private in scope. You cannot have global variables in AvernumScript. You will need to use a SDF, or kludge a way around this limitation.

--------------------
Microsoft Patents Ones, Zeroes (March 25, 1998)
"Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu
Posts: 215 | Registered: Sunday, April 7 2002 08:00
Master
Member # 5977
Profile Homepage #18
Oh my god. This means I'll have to find a totally new way of making that script. Avernumscript! i love you!

EDIT: i made it work. just one small addition: A SDF which I set to 1, when you make an appointment. this SDF I also put in the scenario script (The START_STATE), in which it sets a variale to the current day.

that was a bit of a worthless explanation... If anybody wants to understand what i did, I'll post the script later, just ask.

[ Monday, December 26, 2005 04:57: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00