Fallout 2 mod FO2 Engine Tweaks (Sfall)

Timeslip said:
Cubik2k said:
4) how to make a list of strings during working hs_script or gl_script. It is for later display that list in some order?
I have no idea what you mean here, sorry.

I use
list_begin(), list_next(), list_end()

functions, and I'd like to use some specific strings from that list to be displayed later.

For example:
Code:
items_list:=list_begin(LIST_GROUNDITEMS);
while(items_list != 0) do
begin
   item:=list_next(items_list);
   if (item) then 
   begin
	  if (random(0,100) <= 33 then
	  begin
          create_message_window(obj_name(item)); // this obj_name(item)s I'd like to use later
	  end
   end
end 
else 
begin
   list_end(items_list);
   items_list := 0;
end

In that code I'd like to store specific items (displayed in message_window) to the other list for later use.



Another idea:
On worldmap when I am on mountain zone or ruined city etc. then when enter to map (not to location) then I appear always on desert map. Is there a method to appear in mountain or ocean etc random map ?
 
Cubik2k said:
I use
list_begin(), list_next(), list_end()

functions, and I'd like to use some specific strings from that list to be displayed later.

For example:
<snip>

In that code I'd like to store specific items (displayed in message_window) to the other list for later use.
So basically, you want array variables? That would be easy enough for int/floats, (and you could already use sfall globals to do it anyway,) but strings will be a little harder. The way scripts handle them is quite complex...

I guess I'll just have to keep them in fixed size blocks. You'll have to pick a maximum string length when creating the array.
 
Timeslip can you adjust the function that allows the player to highlight the ground items. It currently covers the entire map, could it be maybe 10 hexes maximum from the center of the PC. That way people can’t find hidden objects so easily. :look:
 
No, finding hidden objects is the whole reason it exists. It's working exactly as I want it to work.

Edit: Actually, that's not quite true. I'd like to get it to highlight critters/containers/doors etc too, but they don't seem to be quite as easy to do as items. :(
 
It work too well, and makes hiding objects in a map obsolete. In a messy combat situation it makes perfect sense, but entering a map and simply holding down a button then noting all of the so called goodies is too easy. It needs a distance restriction.
 
I agree on that. I cheated a 'lil bit with this, while playing the RP 2.0. :>
 
As I good understand it can be done by script, highlight all items. I just made global script for searching items. This script works after specific key is pressed.

It could be good to display yellow/red/green/blue/any_other_colour contour of items. Good if it could be scripted ;)

Personally, highlighting hidden items on map could ruin adventure part of game and I do not like that. Those items are hidden for some reason.


Timeslip thanks for attention on my ideas and great new sound feature :)
 
is it winthin the realm of possiblity to add setting vars on objects?similar to kotor scripting language that engine has 64 vars that can be set on each individual object

if too hard or not possible,forget it

edit : scratch that,how about scripting access to the new map_var local_var editor?that and a scripting delay function,that would rule,mainly cause no way to use timer_event with an sfall script

Nirran
 
Timeslip said:
Cubik2k said:
1) using science skill on dude person in script like it is possible with First aid or Doctor skill. Now using science skill on dude does nothing, but it could be useful for some mods.

2) possibility to set a time for float messages, for longer display, without using timed_event_p_proc
Good suggestions. I'll take a look.
1) done and in svn.

2) floats look difficult to control on an individual basis. I could probably add a preset amount of time to the length of each float based on the number of characters it contains, but I couldn't give you control over it from a script, and given that you can already adjust the length of floats globally in the options menu, I don't think it's worth the time.

Nirran said:
is it winthin the realm of possiblity to add setting vars on objects?similar to kotor scripting language that engine has 64 vars that can be set on each individual object
Well yes; you attach a script to the object and add file scope variables to the script. :P Probably not quite what you were after, but that's the way fallout handles it.

Nirran said:
edit : scratch that,how about scripting access to the new map_var local_var editor?
Whatever for? There's nothing that editor does that isn't trivial to do from a script.

Nirran said:
that and a scripting delay function,that would rule,mainly cause no way to use timer_event with an sfall script
Delaying mid script would freeze up the whole game. Probably not the effect you are after. :P

You need pick a time the event needs to run, then compare the current time against that time each time the script runs. Is there any way to get the current real time from a script, rather than game time? I could have sworn I'd added a tick_count function, but I don't see it in the list. I'll add that for next time if there isn't already a way to get it.

Edit: yay, I'm not going crazy. I had already added one. It's called 'get_uptime' and will return the time since last reboot in milliseconds. That's what you should be using for timers in global scripts.

.Pixote. said:
It work too well, and makes hiding objects in a map obsolete.
That's like arguing that falche makes combat obsolete, or per's guide make the whole game obsolete. If you think it's cheating, then don't use it, and encourage others not to use it for your maps. (Maybe ask killap to turn it off in the RP's default ddraw.ini? I believe he has it turned on atm.) It's a feature I added for myself to give back what I was used to in infinity engine based games. I'm not forcing it down your throat.
 
Timeslip said:
Nirran said:
edit : scratch that,how about scripting access to the new map_var local_var editor?
Whatever for? There's nothing that editor does that isn't trivial to do from a script.

i havent actualy messed with the editer,but i was under the impression that it allowed for setting script local_var from within the editor,if thats not the case,ignore my post

Nirran
 
Nirran said:
i havent actualy messed with the editer,but i was under the impression that it allowed for setting script local_var from within the editor,if thats not the case,ignore my post
No, in 2.6 all it can do is global vars, map vars (of the currently loaded map only,) and sfall globals. It also gives a list of the currently loaded critters, but without any editing capabilities. It should be getting critter editing capabilities for 2.7, but I wasn't planning on it being able to look at local script variables.

If you want to get/set variables of one script from another script, you'll have to either use globals as intermediates, look at using the export keyword to call one scripts procedures from another, (I've no idea how exported procedures work, so I'm not sure that would be any help,) or wait for 2.7 and use arrays instead. (Arrays can be shared between scripts, which makes passing variables between scripts really easy, without having to duplicate things into globals.) Really though, if a piece of data is needed from multiple scripts, it should probably be global in the first place.

Speaking of arrays, they came out rather more nicely than I was expecting. As an example, the code below compiles and runs.
Code:
procedure start begin
  variable va;
  va:=create_array(3,8);
  va[0]:=1;
  va[1]:=1.5;
  va[2]:="bingle";
  display_msg(""+va[0]+" - "+va[1]+" - "+va[2]);
  va[va[0]]:=va[3-va[0]];
  display_msg(""+va[1]);
end

Edit: The timer function you were after is get_uptime.
 
Great news Timeslip, thanks.

I'd like to ask, could you make some small example how to use virtual file system? It looks easy but I try to make any new file or get access to a file but I made nothing since 3 hours :( Am I dumb or maybe there are some tricks ? hehe :P
 
Timeslip said:
Nirran said:
i havent actualy messed with the editer,but i was under the impression that it allowed for setting script local_var from within the editor,if thats not the case,ignore my post
No, in 2.6 all it can do is global vars, map vars (of the currently loaded map only,) and sfall globals. It also gives a list of the currently loaded critters, but without any editing capabilities. It should be getting critter editing capabilities for 2.7, but I wasn't planning on it being able to look at local script variables.

If you want to get/set variables of one script from another script, you'll have to either use globals as intermediates, look at using the export keyword to call one scripts procedures from another, (I've no idea how exported procedures work, so I'm not sure that would be any help,) or wait for 2.7 and use arrays instead. (Arrays can be shared between scripts, which makes passing variables between scripts really easy, without having to duplicate things into globals.) Really though, if a piece of data is needed from multiple scripts, it should probably be global in the first place.

Speaking of arrays, they came out rather more nicely than I was expecting. As an example, the code below compiles and runs.
Code:
procedure start begin
  variable va;
  va:=create_array(3,8);
  va[0]:=1;
  va[1]:=1.5;
  va[2]:="bingle";
  display_msg(""+va[0]+" - "+va[1]+" - "+va[2]);
  va[va[0]]:=va[3-va[0]];
  display_msg(""+va[1]);
end

Edit: The timer function you were after is get_uptime.

thank you

Nirran
 
2.7 is up.

Code:
>Added an option to make the karma image on the character screen dependent on your current karma
>Added support for using wma, mp3 or wav files for sound, and new looping script functions
>Added array support in scripts
>Added an option to allow the use of the science/repair skills on critters
>Some debug editor improvements (array and critter editing support)
>updater improvements to prevent the crashes that happened during sourceforges maintenance downtime from reoccurring.

The new sound file support needs a bit of explaining. Since fallout uses directsound internally, which doesn't support compressed data, sound files are played outside of fallout code with directshow instead. You can play the sound files manually using the play_sfall_sound function, which takes one argument for a file name and one as a flag to play the file in a loop. Alternatively, there's an option available in ddraw.ini you can set which will force sfall to check for files with matching names automatically. These will be played as well as the normal acm; since fallout cannot see what sfall is playing, it may be necessary to include a silent acm of an appropriate length in the cases where fallout cares about the existence of the file. Otherwise just skipping the acm wont cause problems. Since they're handled outside of fallout's code, the files need to be loose in the data directory rather than packed into a dat.

Array support is the first time I've hacked at the compiler for anything other than simply adding new opcodes, so keep an eye out of anything weird. If something using normal array syntax doesn't work correctly, try using the equivalent set/get_array functions to rule out a miscompilation. In terms of usage, the most important thing is to remember to free them when you've finished. A script that leaks an array each time it runs is going to inflate your save file like a balloon.

Also, while its not really part of sfall, since I was poking at the compiler anyway, I've also added support for constant integers in hex format while I was at it. Prefix a number with 0x to specify hex format. (e.g. 'va:=0xff')

Cubik2k said:
I'd like to ask, could you make some small example how to use virtual file system? It looks easy but I try to make any new file or get access to a file but I made nothing since 3 hours :( Am I dumb or maybe there are some tricks ? hehe :P
The obvious thing to check is that you have 'UseFileSystemOverride=1' set in ddraw.ini. I don't have any example scripts using them lying around atm, (which is odd, because I know I wrote one that switched the red and blue channels in colour.pal... Must have got lost somewhere when I switched computers,) but I'll try and make one for you if the ini setting isn't your problem.
 
First, thanks for so quick news :)

I already have enabled UseFileSystemOverride=1 in ddraw.ini file. The problem is other. I send you a small script code on PM for claryfing my problem.
 
For the benifit of anyone not spying on PMs, here's a short script using the file system functions to swap the red and blue channels of the default palette.
Code:
procedure start begin
	variable begin file; i; p1; p2; p3; end
	file:=fs_copy("color.pal", "color.pal");
	i:=0;
	while i<256 do begin
		p1:=fs_read_byte(file);
		p2:=fs_read_byte(file);
		p3:=fs_read_byte(file);
		fs_seek(file, fs_pos(file) - 3);
		fs_write_byte(file, p3);
		fs_write_byte(file, p2);
		fs_write_byte(file, p1);
		i+=1;
	end
end

and since I've been working on the compiler again for a couple of hours today, here's that script rewritten using as much of the new stuff as I could squeeze in, although for something this small it probably hurts readability more than it helps, even if it does make things more compact.

Code:
procedure start begin
	variable file, i, j, d[3];
	file:=fs_copy("color.pal", "color.pal");
	for i:=0; i<256; i++; begin
		for j:=0; j<3; j++; d[j]:=fs_read_byte(file);
		fs_seek(file, fs_pos(file) - 3);
		for j:=0; j<3; j++; fs_write_byte(file, d[2-j]);
	end
end
 
Timeslip said:
For the benifit of anyone not spying on PMs, here's a short script using the file system functions to swap the red and blue channels of the default palette.
Code:
procedure start begin
	variable begin file; i; p1; p2; p3; end
	file:=fs_copy("color.pal", "color.pal");
	i:=0;
	while i<256 do begin
		p1:=fs_read_byte(file);
		p2:=fs_read_byte(file);
		p3:=fs_read_byte(file);
		fs_seek(file, fs_pos(file) - 3);
		fs_write_byte(file, p3);
		fs_write_byte(file, p2);
		fs_write_byte(file, p1);
		i+=1;
	end
end

and since I've been working on the compiler again for a couple of hours today, here's that script rewritten using as much of the new stuff as I could squeeze in, although for something this small it probably hurts readability more than it helps, even if it does make things more compact.

Code:
procedure start begin
	variable file, i, j, d[3];
	file:=fs_copy("color.pal", "color.pal");
	for i:=0; i<256; i++; begin
		for j:=0; j<3; j++; d[j]:=fs_read_byte(file);
		fs_seek(file, fs_pos(file) - 3);
		for j:=0; j<3; j++; fs_write_byte(file, d[2-j]);
	end
end
Just for clarification - this script would affect all files within a map at once or can this be used to address a specific file - say a .pro?

Please forgive me if the answer is obvious but I not really a scriptor.
 
thnks timeslip for the very cooool control party members feature, finally my 10 years dream come true lol

but there is a little bug (dunno if this is a bug or not).. seems my perk also effect other party members, so if i have quick pocket perk then party members also use 2 ap to acces inventory, is this a bug or intentional?
 
Timeslip said:
2.7 is up.

>Added support for using wma, mp3 or wav files for sound, and new looping script functions

That mean I can create new music to fallout without using very old dos programs (wich don't work in new OS like vista and 7) to convert the .mp3, .wav file to .acm? :shock:
If that's the case, I love you! Because I was trying to convert some musics I made to fallout 2, and I had to give up, 'cause it's more easy to climb mount Everest than convert a sound file to .acm. :tired:
 
possible to add a LIST_SCENERYITEMS?

edit : removed request,already possible

edit : get_uptime compiles,but it crashes the game,with memory adress fffffff(could not be read)

edit : :rofl: just read the credits movie :clap:

Nirrtan
 
Back
Top