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 27 8 9121 122 Next To the start

old Re: Scripting Questions

Satis
User Off Offline

Quote
hehe yep dialouge works fine for me
wasactualy on my way in to tell that I found out on my own
But thanks anyway

EDIT

is there a way to asign a key to to do an event ??

if so, then how ?

//Satis
edited 1×, last 11.10.07 09:17:26 pm

old Re: Scripting Questions

bizzl
User Off Offline

Quote
You mean for opening something with a key?
try the following in the script of the thing to open:
1
2
3
4
5
6
7
8
9
10
on:use {
	if (getplayerweapon()==[i]ID of Key[/i]) {
		[i]//Do whatever you want
	} else {
		local $tmp;
		$tmp=name("item",[i]ID of Key[/i]);
		msg join("I need a ",$tmo," to open it!"),3;
		freevar $tmp;
	}
}

old Re: Scripting Questions

Satis
User Off Offline

Quote
sorry but no...
that is not what I'm looking for.

what I ment was how to bind a keybord key to a event or somthing like that...

The thing I wanna do is to bing key "R" to make a research on the selectet item or the item that I hold in my hands.

hmmm I should have descriped it in more details in the first post :S

Sorry

//Satis

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
youve got to write this line in the game.inf

1
2
3
4
scriptkey=ID,Name

Example:
scriptkey=0,research

And write a script like this in the game.inf, too.
1
2
3
on:keyhit00 { event "research_hit","global"; }
on:keydown00 { event "research_down","global"; }
on:keyrelease00 { event "research_release","global"; }

old Re: Scripting Questions

bizzl
User Off Offline

Quote
oh, you mean script keys. That's a more delicate problem.
You have to add following line to your game.inf:
1
scriptkey=0,Open
It registers a scriptkey with the label "Open" to ID 0 (you can have big bunch of IDs, I checked something over twenty, which is plenty)
then, add following to the script in the game.inf:
[code] on:keydown00 { event "openkeydown",0,0; }
on:keyhit00 { event "openkeyhit",0,0; }
on:keyrelease00 { event "openkeyrelease",0,0; } [/quote]
You can now use the key in maps via simple events in your objects or whatever.
You have to check up if everything is correct, of course, since the event get fired at global scope...

old Re: Scripting Questions

Satis
User Off Offline

Quote
WOW that was a quick answere
under 5 min and pop

so how will this reconice I'm pressing keybord key "R" ??
I know that the keynumber is 19 for key "R" as is listed in keys.inf file.

and what is it with the dobble 0 in the on:keyhit00 ??

//Satis

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
you can choose any id you want, you don't have to use those from the keylist. The only thing that isn't allowed are two simmilar ids for diffrent scriptkeys.
Scriptkeys don't have spezial keys defined to them by default, you've got to tell S2 wich Scriptkey is wich key in the optionsmenu.

the double 0 in keyhit00 is the id, too. pressing the key, that is defined to the Scriptkey with the id 0 will fire up the event keyhit00. understood? Pressing a Scriptkey with the id 14 and holding it down will fire up the event keydown14.

old Re: Scripting Questions

Satis
User Off Offline

Quote
arh so asign the key in the option menu

Thanks for the infoes Flying lizard and Bizzl, now I can continue my research

Kind regards
Satis


EDIT

Oh one last thing for today
when you are in the backpack menu and select an item so it have the green square around it, and I use my research key.
what commang is used for getting the item id from the selected on ?? or do I have to pute it in the weapon slot and use the getplayerweapon to get the item id ??

//Satis
edited 1×, last 12.10.07 12:07:54 am

old Re: Scripting Questions

Satis
User Off Offline

Quote
Flying Lizard has written
The Thing with the Backpack isn't possible (yet)


Uh will that say that DC actualy is planing to open for more commands ??

//Satis

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
I'm not sure if this works with add ans msgbox to, but it's worth a try.

Try something like that:
$img=tutorial\grain.bmp

with diary and dialogue it works.

old Re: Scripting Questions

Satis
User Off Offline

Quote
Flying Lizard has written
I'm not sure if this works with add ans msgbox to, but it's worth a try.

Try something like that:
$img=tutorial\grain.bmp

with diary and dialogue it works.


em it is a Dialog box and I can use the: $img=tutorial\grain.bmp
in the text=start - text=end but when I add $img=tutorial\grain.bmp into an add function in a dialog, it just write: 0=tutorial\grain.bmp and no image :S

//satis

old Re: Scripting Questions

Flying Lizard
User Off Offline

Quote
well, I think that's because in add, he puts in the value of $img

maybe you could work around it by giving $img the value "$img", do you understand what I mean?

old Re: Scripting Questions

Satis
User Off Offline

Quote
hmmm I'm afraid not :S

BTW: I don't need to put an image in it, just wondering, since it would be cool

//Satis

old Re: Scripting Questions

bizzl
User Off Offline

Quote
Flying Lizard wants you to try the following
1
2
3
local $img;
$img="$img";
add "$img=tutorial\grain.bmp";
I am not sure, but perhaps it could work without an extra variable:
1
add join("$","img=tutorial\grain.bmp");

old Re: Scripting Questions

Satis
User Off Offline

Quote
bizzl has written
Flying Lizard wants you to try the following
1
2
3
local $img;
$img="$img";
add "$img=tutorial\grain.bmp";
I am not sure, but perhaps it could work without an extra variable:
1
add join("$","img=tutorial\grain.bmp");


okay tryed both options and none worked :S

The first one just returned a: 0=tutorial\grain.bmp
and
that one with the join function, justcleared the rest of the text from that point :S

well nvm I think I found a way to do it, but it will just not be an s2 cmd add function

//Satis

old Image in diary

Polaris
User Off Offline

Quote
Hello!

Hmm sorry to cut off your talk Satis bur i have a simple short question to ask.

When i display an image in the diary is it possible that an image is displayed at the end of a line: i explain

1
2
- utilises 
$img=tutorial\util.bmp
display that
IMG:https://vasquez.neuf.fr/test.jpg

But
1
- utilises $img=tutorial\util.bmp
display this:
IMG:https://vasquez.neuf.fr/test1.jpg


Is it possible to display my image at the end ond my string on the same line of this string?

Thanks you much for any help!
I have look at the help function on the deutsch site but i havn't found anything.

Hope you will understand what i am saying.
see you and thanks!

old Re: Scripting Questions

bizzl
User Off Offline

Quote
Nope, there is atm no way on code level to have text and image in one line.
However, you could try to build the text into the image with an image editor, like gimp
To the start Previous 1 27 8 9121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview