Instant death nodes

Pages

AuthorTopic: Instant death nodes
Canned
Member # 8014
Profile #25
I'm still confused. I don't see how i isn't defined.
Here is the whole script:
begintownscript;

variables;

short

body;

beginstate INIT_STATE;

// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);




beginstate START_STATE;


if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } }
Man, the copy and paste thing acts up with Notepad.

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Shaper
Member # 3442
Profile Homepage #26
"Defining i" can be said much more clearly by saying "tell BoA that you are going to use a variable called 'i'".

So, firstly, I'm assuming you know what a variable is. It's a number (usually) that either changes in value, or that you don't know the value of. Think alegbra in the example I'm about to show you, i = 3.

i + 2 = 5. i is the variable, since we didn't know what it was until we did the equation.

Now, in order to tell BoA that you are going to use a variable, you have to write it down in the script. So, under the variables; line, you'd write "int i;" (but without the quotation marks).

E.g:

begintownscript;

variables;

int i;

body;
See? The "int" bit just tells BoA that the variable is an integer, or, basically, a whole number. You can also use the term "short", (by writing "short a;" for example, though I'd just stick to int for now.

Hope that's clearer...

--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Canned
Member # 8014
Profile #27
Thankyou, that helped.

But now it is saying: t3 Error: State not ended properly in line 18.

And I don't see any problem at all
Here is the script:
begintownscript;

variables;

short

body; int i;


beginstate INIT_STATE;

// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);




beginstate START_STATE;


if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } };


--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Infiltrator
Member # 5576
Profile Homepage #28
The key word "beginstate" does just what it says and begins a state. Each state must then be ended by using the "break" keyword. Like this:
beginstate START_STATE;
//the contents of the state
break;
You need one break for every beginstate, and you can't begin another state until you've ended the previous one.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shaper
Member # 3442
Profile Homepage #29
I see a few errors.

1)The variable needs defining before the "body" bit of the script. It's annoying at first, but you'll get the hang of it. The order is:

begintownscript;

variables;

int i; //THIS IS WHERE IT HAS TO GO!!

body;
2)Both the INIT_STATE and START_STATE need a "break;" command at the end. This is the "state not ended" thing. A "break" call tells BoA you've finished that bit of code. Look:

beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);
break; //YOU'RE MISSING THIS


beginstate START_STATE;
if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } };
break; //AND THIS - IT TELLS BOA WE'RE DONE.


--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Canned
Member # 8014
Profile #30
Thank you, that fixed the problem yet another one came up.

t3: Bad expression in line 22
I don't get what a "Bad expression" is.

begintownscript;

variables;

int i;
short

body;

beginstate INIT_STATE;

// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);

break;



beginstate START_STATE;


if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } };
break;


--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Shaper
Member # 3442
Profile Homepage #31
A bad expression is a mathematical formula that BoA doesn't like. Usually 'cus you've done something wrong...

It's this line:

if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } }; It should be:

if(get_crime_level(1) > 0) {
i = 0;
while(i < 4) {
kill_char(i,3,0);
i = i + 1;
}
}
It's not necessary to write code out like that, but it helps when starting out because you can see which if calls do what.

--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Canned
Member # 8014
Profile #32
I fixed it, but it still says it.
And I can't identify what is wrong.

begintownscript;

variables;

int i;
short

body;

beginstate INIT_STATE;

// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);

break;



beginstate START_STATE;


if(get_crime_level(1) > 0) {
i = 0;
while(i < 4) {
kill_char(i,3,0);
i = i + 1;
}
} ;
break;


--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Lifecrafter
Member # 6193
Profile Homepage #33
Technically writing it all as one line is fine (Although it's DEFINITELY not advised) but the real problem is that your while statement doesn't close parentheses. This can be spotted fairly easily if you follow Nikki's advice and split your code into multiple lines, and it's advisable to do so for a myriad of other reasons as well (I started out making the same mistake and writing code as one line like that-- it wasn' pretty. Do yourself a favor and stop right now.)

Edit: And you fixed it in that post. The new problem is the final ";" you only use semicolons at the end of a call, not after parenthesis or brackets.

[ Sunday, January 06, 2008 13:08: Message edited by: Lazarus. ]

--------------------
"NOW PASS ME MY BOOTS. I HAVE AN APPOINTMENT WITH A FACE." -Nikki

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00
Shaper
Member # 3442
Profile Homepage #34
begintownscript;

variables;

int i;
short //YOU DON'T NEED THIS BIT.

body;

beginstate INIT_STATE;

// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);

break;



beginstate START_STATE;


if(get_crime_level() > 0) { //YOU DON'T NEED A ONE IN THE BRACKETS
i = 0;
while(i < 4) {
kill_char(i,3,0);
i = i + 1;
}
} //YOU DON'T NEED A SEMI-COLON HERE
break;
[/QB][/QUOTE]

Remove my comments, and it should work.

--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Agent
Member # 2759
Profile Homepage #35
... and remove the word "short", in case Nikki didn't make that clear.

--------------------
Geneforge 4 stuff. Also, everything I know about Avernum | Avernum 2 | Avernum 3 | Avernum 4
Posts: 1104 | Registered: Monday, March 10 2003 08:00
Canned
Member # 8014
Profile #36
Edit -Nevermind, fixed. Thank you.

[ Sunday, January 06, 2008 13:18: Message edited by: Iffy ]

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Agent
Member # 2759
Profile Homepage #37
You forgot to remove the 1. It should be

get_crime_level()

--------------------
Geneforge 4 stuff. Also, everything I know about Avernum | Avernum 2 | Avernum 3 | Avernum 4
Posts: 1104 | Registered: Monday, March 10 2003 08:00
Shaper
Member # 3442
Profile Homepage #38
quote:
Originally written by Lazarus.:

Edit2: Huh, so get_crime_level() doesn't take a town number as an arguement-- makes it awkward to pull an Anama kind of deal and make a whole province pissed off.
A SDF is probably how Jeff did it in A3, I'm guessing; although including an option to take town numbers would be nice, it's not much more work to do it the long way.

--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Canned
Member # 8014
Profile #39
Okay, I tried putting a code that creates a dialoge box just before you die, but it didn't work.

I tried using the "void message_dialog" call, but I must of not done it right.

Where does it go? Is it the right call?

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Agent
Member # 2759
Profile Homepage #40
If you included the word "void", you probably did it wrong.

message_dialog("Why not peek at an existing scenario's scripts and copy paste what you need, changing where appropriate?","");

[ Sunday, January 06, 2008 13:38: Message edited by: Micawber ]

--------------------
Geneforge 4 stuff. Also, everything I know about Avernum | Avernum 2 | Avernum 3 | Avernum 4
Posts: 1104 | Registered: Monday, March 10 2003 08:00
Canned
Member # 8014
Profile #41
I placed it wrong. I got the message...every single step.

Where should it go?

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Shaper
Member # 3442
Profile Homepage #42
beginstate START_STATE;
if(get_crime_level(1) > 0) {
i = 0;
while(i < 4) {
kill_char(i,3,0);
message_dialog("Your message",""); //HERE
i = i + 1;
}
}


--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Lifecrafter
Member # 6193
Profile Homepage #43
quote:
Originally written by Funkadelic:

beginstate START_STATE;
if(get_crime_level(1) > 0) {
message_dialog("Your message",""); //HERE
i = 0;
while(i < 4) {
kill_char(i,3,0);
i = i + 1;
}
}

FYT. :P

Void and short are used in the appendix to tell you what type of call it is (Specifically whether or not that call returns a value.) You never actually write short get_health() or void message_dialog(), just the actual call.

--------------------
"NOW PASS ME MY BOOTS. I HAVE AN APPOINTMENT WITH A FACE." -Nikki

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00
Shaper
Member # 3442
Profile Homepage #44
quote:
Originally written by Lazarus.:

quote:
Originally written by Funkadelic:

beginstate START_STATE;
if(get_crime_level(1) > 0) {
message_dialog("Your message",""); //HERE
i = 0;
while(i < 4) {
kill_char(i,3,0);
i = i + 1;
}
}

FYT. :P

The stupid thing is, I was writing out instant death nodes for my own scenario when I wrote that, and, looking at my scripts, I did it wrong there too...

--------------------
Nikki's Nook - bigger than Jesus?
Posts: 2864 | Registered: Monday, September 8 2003 07:00
Law Bringer
Member # 2984
Profile Homepage #45
All this takes me back to '94 when I began to learn Logo... :)
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Shock Trooper
Member # 10488
Profile #46
Yay Logo! That was the first "programming" language I ever learnt. :P

It's almost amazing what you can do with it though.
Posts: 334 | Registered: Friday, September 14 2007 07:00
Agent
Member # 2759
Profile Homepage #47
Me too. A little earlier than 1994, however.

--------------------
Geneforge 4 stuff. Also, everything I know about Avernum | Avernum 2 | Avernum 3 | Avernum 4
Posts: 1104 | Registered: Monday, March 10 2003 08:00
Shock Trooper
Member # 10488
Profile #48
For me, it would have been later than 1994, I think. I would have been... um... seven in 1994? Something like that. I don't think I started learning Logo quite that early. I think it was after I got my first Mac (an LC 68k!).
Posts: 334 | Registered: Friday, September 14 2007 07:00
Canned
Member # 8014
Profile #49
Uh, what is "Lego"?

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00

Pages