Forum

> > Stranded II > Scripts > Scripting Questions
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Scripting Questions

2.429 Antworten
Seite
Zum Anfang Vorherige 1 28 9 10121 122 Nächste Zum Anfang

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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

alt Re: Scripting Questions

bizzl
User Off Offline

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

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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

alt loop types and syntax?

Eagle246
User Off Offline

Zitieren
according to the english scriptcommands:
Zitat
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?

alt Re: Scripting Questions

Mc Leaf
Super User Off Offline

Zitieren
Eagle246 hat geschrieben
according to the english scriptcommands:
Zitat
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 hat geschrieben
Also is there a way to break a loop before it gets to the end?

yes, "exit"

alt Re: Scripting Questions

Eagle246
User Off Offline

Zitieren
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?

alt Re: Scripting Questions

Mc Leaf
Super User Off Offline

Zitieren
Eagle246 hat geschrieben
Thanks,
Next Question:
Does "objects", "units", "items", and "infos" repeat the Instructions for each one of the type?

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

wouldn't work by the way (alteritem has to be used at "use"-events).
Eagle246 hat geschrieben
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(...) {
		.
		.
		.
	}
}

alt Re: Scripting Questions

bizzl
User Off Offline

Zitieren
Mc Leaf hat geschrieben
Eagle246 hat geschrieben
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

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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

alt Re: Scripting Questions

Mc Leaf
Super User Off Offline

Zitieren
Satis hat geschrieben
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.

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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
2× editiert, zuletzt 26.10.07 23:33:40

alt Re: Scripting Questions

Mc Leaf
Super User Off Offline

Zitieren
Satis hat geschrieben
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 hat geschrieben
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...

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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

alt Re: Scripting Questions

Mc Leaf
Super User Off Offline

Zitieren
Flying Lizard hat geschrieben
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...?

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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

alt Re: Scripting Questions

Flying Lizard
User Off Offline

Zitieren
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
}

alt Re: Scripting Questions

Satis
User Off Offline

Zitieren
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
1× editiert, zuletzt 28.10.07 17:55:41

alt Re: Scripting Questions

Flying Lizard
User Off Offline

Zitieren
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)
Zum Anfang Vorherige 1 28 9 10121 122 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht