Forum

> > Stranded II > Scripts > Scripting Questions
Forums overviewStranded II overview Scripts overviewLog in to reply

English Scripting Questions

2,429 replies
Page
To the start Previous 1 278 79 80121 122 Next To the start

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
Ok im trying to make it so you can bottle salt water and fresh water so heres my script i did a fake part as you can see inarea_saltwater i want to make it so i can do that because if i do inarea_fresh water and make it 0 then i can bottle salt water wherever i am so im trying to make it so if your close to salt water get salt water and if fresh water get fresh water.

     on:usesea {
          if ( ((count_behaviourinrange("object","fountain",50)+count_behaviourinrange("object","watersource",50))>0) or (inarea_freshwater("unit",1)==1) ){
               alteritem 1,38;
               msg "I filled the bottle!",4;
               speech "positive";
          } else {
          if (inarea_saltwater("unit",1)==1) {
               alteritem 1,499;
               msg "I filled the bottle!",4;
               speech "positive";
          } else {
               msg "I have to be close",3;
               msg "to water!",3;
               speech "negative";
               }
          }
     }
edited 1×, last 09.11.09 08:31:44 pm

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
Theres another problem
that every time you press use button you will get msg
you have to be close
which means spamming

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
nvm that one i need help with this one:
Spoiler >

Spoiler >



IF I DONT GET HELP ON THIS IM SHUTTING DOWN XIOLION THIS FEATURE WRAPS THE WHOLE SYSTEM OF XIOLION SO IF THIS DOESNT WORK YOU CANT MAKE HALF OF ALL OF THE THINGS IN XIOLION AND CANT MAKE MAIN FEATURES TO SURVIVE ON XIOLION!
edited 2×, last 09.11.09 08:47:14 pm

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
1 you've got to add another bracket closing if ($order==0){
and on the menu you've got to add script=start and script=end. I would also check your brackets again just to be safe, and tabbing every time you open a bracket is a good way to keep track of things.

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
Ok now it doesnt error but it doesnt do anything either:
(This is in the Game.inf so theres already start and end)
Spoiler >

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Should be this...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
on:usesea { 
               temp $menuclass,$menuid; 
               $menuclass=currentclass(); 
               $menuid=currentid(); 
               		if ($order==0){ 
               		dialogue "start","sys\scripts\game.s2s"; 
			}
               if ($order>0){ 
			if ($order==1){ 
                  		 if (inarea_freshwater("unit",1)) { 
                     	 	   process "drinking",1000; 
               		   	   drink 0,0,25,0; 
                		}else{ 
                         		process "drinking",1000; 
     	                 		 drink 0,0,-15,0; 
                         		msg "Ugh! Saltwater!"; 
				}
                    	} elseif ($order==2){ 
                    		if (inarea_freshwater("unit",1)) { 
                         		alteritem 1,106,1,38; 
                         		msg "I filled the bottle!",4; 
                         		speech "positive"; 
                   	 }else{ 
                    		if (count_stored("self",106)>0){ 
                         	alteritem 1,106,1,499; 
                         	msg "I filled the bottle!",4; 
                         	speech "positive"; 
                          } 
                  } $order=0;
           }

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
I get this error so i added 2 brackets and it just fixed it but dident do anything when i used the water except open the menu and when i clicked an option the bored went blank...

Try working on it on yours heres the code:

Error:
Somthing like missing bracket at like the end line.

Game.inf:
on:usesea {
temp $menuclass,$menuid;
$menuclass=currentclass();
$menuid=currentid();
if ($order==0){
dialogue "start","sys\scripts\game.s2s";
}
if ($order>0){
if ($order==1){
if (inarea_freshwater("unit",1)) {
process "drinking",1000;
drink 0,0,25,0;
}else{
process "drinking",1000;
drink 0,0,-15,0;
msg "Ugh! Saltwater!";
}
} elseif ($order==2){
if (inarea_freshwater("unit",1)) {
alteritem 1,106,1,38;
msg "I filled the bottle!",4;
speech "positive";
}else{
if (count_stored("self",106)>0){
alteritem 1,106,1,499;
msg "I filled the bottle!",4;
speech "positive";
}
} $order=0;
}
}
}


Game.s2s:
page=start
title=Water Menu
text=start
What should i do?
text=end
button=gw,Gather Water
button=dw,Drink Water
button=action:close,Nothing

page=gw
setlocal $menuclass,$menuid,"order",1;
closemenu;

page=dw
setlocal $menuclass,$menuid,"order",2;
closemenu;
edited 1×, last 10.11.09 02:21:24 am

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
When You use the elseif you're saying if the order is NOT greater than zero but IS equal to 2. This is an impossibility. Again, for the pages, you need to add script=start and script=end on the ends of your script.
page=gw
script=start
setlocal $menuclass,$menuid,"order",1;
closemenu;
script=end
Keep learning

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
LOL I FROGOT THE SCRIPT=START AND END FOR IT!

Ok now when i use it it only wants to drink it and not gather it no matter what option you choose.
edited 1×, last 10.11.09 03:21:26 am

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
I KNOW SOMTHING STUPID IS HAPPENING

          if (inarea_freshwater("unit",1)) {
               process "drinking",1000;
               drink 0,0,25,0;
          }else{
          if (count_stored("self",106)>0){
               alteritem 1,106,1,499;
               msg "I filled the bottle!",4;
               speech "positive";
                    }
               }
          }

why isent this working?
edited 1×, last 11.11.09 12:31:14 am

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
it should be
}elseif (count_stored("self",106)>0){
instead of
}else{
if (count_stored("self",106)>0){

old Re: Scripting Questions

JadeStone
User Off Offline

Quote
Ok i fixed it my self by putting my brain to it if anyone wants the script i dont mind but please credit me:

     on:usesea {
          if (inarea_freshwater("unit",1)) {
          process "drinking",1000;
          drink 0,0,25,0;
          }else{
          if (count_stored("unit",1,106)>0){
          alteritem 1,106,1,499;
          msg "I filled the bottle!",4;
          speech "positive";
          }else{
          msg "I dont have a bottle!",3;
          speech "negative";
          }
     }
}
edited 1×, last 11.11.09 05:28:34 am

old Re: Scripting Questions

Phyire
User Off Offline

Quote
Why doesnt this work when I 'use' on the pirate?

Spoiler >

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
Phyire has written
Why doesnt this work when I 'use' on the pirate?

Spoiler >


just putting the script wont work
you have to put an event too
like on:use

old Re: Scripting Questions

Fubbles
User Off Offline

Quote
Heya, i went through some of the tutorials, but couldnt seem to find anything..im making a simple island, that basically is centered on one thing; Clutter. I want a thick thick THICK jungle. Thats easy to make.

My problem is that i want the player to be able to do numerous things. I dont know if these are even probable though

After 14 game days, a plane will fly over the island and spot the player, and on Day 15 a boat (yacht) will spot the player, and take him off.

The problem is surviving these 14 days though!



The player will start off with some items, Like;

A Jar
Some Meat
Rope (well thats just handy!)
And well...thats it

So i need to know how to script these things;

Script the players starting position. Right now you just start in the middle of the island, but i placed a "Player" unit where i want the player to start, i just dont know how to make him the player...

Script the jar to be able to hold Salt water, then boil over fire into drinkable Fresh water

A person can survive for 2 weeks without food, which is what will need to be possible in this island cause its a tiny one with no predators.

Script the plane and Boat.

Soo far thats all i think ill need. The island it self is medium, so it shouldnt take that long to make it cluttered, im half done now...

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
You need no scripting for the player position. You select infos from the section in the editor, and find player start and place it where you want it.

old Re: Scripting Questions

amstel bier9
User Off Offline

Quote
whats the script if I want to drop an item(ring)
on a building (mount doom)
that than the ring destoyed..
but if i drop on other places..
you can see it... and take it back (like normal)...
To the start Previous 1 278 79 80121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview