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 28 9 10121 122 Next To the start

old Re: Scripting Questions

Satis
User Off Offline

Quote
hmmm I am trying to mage some more of the same item depending on a skill.

I have added this lines in a combi:
1
2
3
4
if ($tmpalchemy < 75) { find 37; }
           elseif ($tmpalchemy < 125) { find 37,random(1,2); }
           elseif ($tmpalchemy < 250) { find 37,random(1,3); }
           else { find 37,random(1,4); }

why does it not work ??

//Satis

old Re: Scripting Questions

bizzl
User Off Offline

Quote
there eventually could be a problem in the S2S parser with blanks in boolean expressions.
Try it without blanks, this sometimes worked for me...

old Re: Scripting Questions

Satis
User Off Offline

Quote
okay tryed it, but it didn't work :S

If i can't get this to work some how, I need to do son other thing instead but I don't know how :S

//satis

EDIT

BIG WOOOPS

heh I put the code the wrong place

so it works now

old loop types and syntax?

Eagle246
User Off Offline

Quote
according to the english scriptcommands:
Quote
loop¦basic¦ ("Mode" [,Number/Type]) { Instructions }

I'm just want to know what are the valid loop Modes.

Also is there a way to break a loop before it gets to the end?

old Re: Scripting Questions

Mc Leaf
Super User Off Offline

Quote
Eagle246 has written
according to the english scriptcommands:
Quote
loop¦basic¦ ("Mode" [,Number/Type]) { Instructions }

I'm just want to know what are the valid loop Modes.

Modes: "objects", "units", "items", "infos" and "count"


Eagle246 has written
Also is there a way to break a loop before it gets to the end?

yes, "exit"

old Re: Scripting Questions

Eagle246
User Off Offline

Quote
Thanks,
Next Question:
Does "objects", "units", "items", and "infos" repeat the Instructions for each one of the type?
eg:
loop("items",9){
alteritem 1,9,1,10;
}
Would this turn every Meat (ID 9) into Fried Meat (ID 10)?
(poor eg, but you get the idea)

Also, It appears you can't have a loop inside a loop, this seems to cause an error. Is that because S2 just doesnt support it?

old Re: Scripting Questions

Mc Leaf
Super User Off Offline

Quote
Eagle246 has written
Thanks,
Next Question:
Does "objects", "units", "items", and "infos" repeat the Instructions for each one of the type?

Yes, but...
Eagle246 has written
loop("items",9){
alteritem 1,9,1,10;
}

wouldn't work by the way (alteritem has to be used at "use"-events).
Eagle246 has written
Also, It appears you can't have a loop inside a loop, this seems to cause an error. Is that because S2 just doesnt support it?

Right, but I don't know the reason. But you could use a little trick, for example
1
2
3
4
5
6
7
8
9
10
11
loop("count",10) {
	event "anything";
}

on:anything {
	loop(...) {
		.
		.
		.
	}
}

old Re: Scripting Questions

bizzl
User Off Offline

Quote
Mc Leaf has written
Eagle246 has written
Also, It appears you can't have a loop inside a loop, this seems to cause an error. Is that because S2 just doesnt support it?

Right, but I don't know the reason.

That's pretty simple: DC didn't implemented a way to state a variable for iteration, but by giving a function s2 cmd loop_id that returns the current iteration, and he forgot to implement a stack for the iteration counter, type and jump adresses

old Re: Scripting Questions

Satis
User Off Offline

Quote
Question!

When you add a stat like fire to a fire place, can I set it to spawn another place than the center X,Y,Z axes on the model ??

if so, then how is it done ??

Kind regards
Satis

old Re: Scripting Questions

Mc Leaf
Super User Off Offline

Quote
Satis has written
Question!

When you add a stat like fire to a fire place, can I set it to spawn another place than the center X,Y,Z axes on the model ??

if so, then how is it done ??

Kind regards
Satis

In the definition of the object (see objects*.inf) you can set the relative coordinates of the state with "state=x,y,z". For example "state=0,50,0" to set the position at 50px over the center of the object.

old Re: Scripting Questions

Satis
User Off Offline

Quote
arh thanks

>>EDIT<

One relatet question.
is there a way to calculate the position or is it just to try it out and then corect it ??


New Question:
I'm having a problem in my mod, that when I use the USEKEY (defult E key) it lags for ½ sec or so.
The same is when I'm using my research button..½ sec lack and then the progress bar comes.
What can cause that ?

//Satis
edited 2×, last 26.10.07 11:33:40 pm

old Re: Scripting Questions

Mc Leaf
Super User Off Offline

Quote
Satis has written
is there a way to calculate the position or is it just to try it out and then corect it ??

To calculate the position you would have to enter adequate input data, and what do you expect what kind of input data this would be...?

(^some coordinates of the position as well, of course)

Satis has written
New Question:
I'm having a problem in my mod, that when I use the USEKEY (defult E key) it lags for ½ sec or so.
The same is when I'm using my research button..½ sec lack and then the progress bar comes.
What can cause that ?

If this bug only appears when using your mod (try that with the standard version of Stranded to check this), it must have something to do with your mod itself. In this case you'll have to encircle this bug by disregarding specifically parts of codes which could trigger this bug...

old Re: Scripting Questions

Satis
User Off Offline

Quote
well yes it is only in my mod..... did allready test that from the start, but forgot to mention it when i wrote it in here :S

The function use on ground, I actualy havent done any of.
well it could be a memory leak in one of my scripts that I should free, but still I'm not sure of it.

ATT: Flying Lizard
well no I do not have any program in the background running for this to interupt with that I know of :S
and remember I don't have this problem when I play the normal S2.

//Satis

old Re: Scripting Questions

Mc Leaf
Super User Off Offline

Quote
Flying Lizard has written
It could also be possible that you've got an extreme long script on those keys.

That's what I also would guess. I don't know if you (Satis) are using the key-Events ("on:keyhitXX" or something like that) in the game.inf...?

old Re: Scripting Questions

Satis
User Off Offline

Quote
the USEKEY I have not added any stuff to, but the research key have 3080 lines of code, so that one will take longer time to run that the normal USEKEY.

Yes I have used on:keyhitXX but again only for the research key :S

//Satis

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
well, I got some big codes too. I worked around bugs like that this way:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
on:keyhit01 {
if (stuff==stuff) {
event "1";
}
else {
event "2";
}

on:1 {
all the big scriptingstuff
}

on:2 {
all the big scriptingstuff
}

old Re: Scripting Questions

Satis
User Off Offline

Quote
arh har... so splitting up the big script to smallere ones, will reduce the time for the engien to read all the scripts
so lets say that I cut down the main key hit function to 200 lines and not 3000+ line and split all the other stuff up in small events that will be fired from the first if statment checker...

That makes alot of sence

//Satis

>>EDIT<
When you look at the object_building.inf file, I notis 2 commands that I cant figure out.

What is:
fx=somthing
col=somthing

//Satis
edited 1×, last 28.10.07 05:55:41 pm

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
fx=value
efect (addition: 1=glow, 8=no fog, 16=show both sides)

col=value
collision (0=no collision, 1=colision, 2=just use, 3=collision even if far away, 4=climbing-collision)
To the start Previous 1 28 9 10121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview