[LIB] mEngine 1.0

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

[LIB] mEngine 1.0

Post by PrizzZ » Fri, 10. Mar 06, 03:23


1. Info
Image
  • Nom: mEngine
    Version: 1.1b
    Scripter: PrizzZ
    xml used: xx7777.xml
    t id used: 7777

    Download :
    1.1b: mEngine.zip



2. Functions
Image
  • This lib is used to emule a menu thanks to the "send incoming question" command.
    THIS IS NOT A SCRIPT, it's just a tool for scripter to use less command slot and
    improve their scripts by asking the player wanted datas like a sector, a ship type, etc ...
    without waiting for the player to enter the datas by the slot command.

3. Use
Image

  • All you have to do is to install mEngine on your game folders and call lib.mEngine.askfor.
    This script needs 1 argument : an array which contains what you want to be asked to the user
    thanks to the following object you can put in that array. The answers will be return by the script
    in an array, in the same order as the question comes.

    Here are the following inputs for the array :
    • Custom : you can input an array of string. The menu will display the string in order
      and return the number of the wanted string.

      Code: Select all

      $wanted =  array alloc: size=0
      $custom =  array alloc: size=0
      append "test1" to array $custom
      append "test2" to array $custom
      append "test3" to array $custom
      append $custom to array $wanted
      $wanted = [THIS] -> call script 'lib.mEngine.askfor' :  Wanted=$wanted 

      if you select test2, the script will return an array of one element which
      will be 1. Don't be affraid, this is the MOST COMPLICATED exemple !
    • Numbers : you can input a number of the following list, it will return the choosen element
      of that list. The possibilities are actually :
      • 0. Sectors
        1. A number !
        2. Player Owned ( ships and stations )
        3. Player ships
        4. Player station
        5. Ship type
        6. Ware type
        7. Object in sector
        8. Fighter type
        9. Big Ship type
        10. Player ship excluding satellites, mines and drones.
        11. Player owned bases : Carriers and stations

      In fact many more can be easily scripted, excepted string entries and few other exceptions.

      Code: Select all

      $wanted =  array alloc: size=0
      append 7 to array $wanted
      append 1 to array $wanted
      $wanted = [THIS] -> call script 'lib.mEngine.askfor' :  Wanted=$wanted
      this will ask to the player first a sector, then an object in that sector, and then a
      number, and put the array of answers in $wanted. Easy, no ?
    This lib support multiple demands at the same time.
    Note: If the user cancel the selection, lib.mEngine.askfor will return null.

4. Version
Image
  • 1.1b : 07.08.2007

    New features :
    • Add the 11th menu type
    1.1 : 31.07.2007

    New features :
    • Add the 10th menu type
    • Add the "Cancel" function
    • Add filters for un-used elements and ReadText
    1.0 : first release ( 10.03.2006 )


    Fell free to add comments, propose improvements and ask for more inputs !
Last edited by PrizzZ on Sun, 3. Feb 13, 13:01, edited 2 times in total.

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Fri, 3. Aug 07, 13:29

  • 31.07.2007 : 1.1 release
    Image
    New features :
    • Add the 10th menu type
    • Add the "Cancel" function
    • Add filters for un-used elements and ReadText
    See above for download and details.

Kilrathi Avenger
Posts: 275
Joined: Fri, 6. Feb 04, 20:16
x3tc

Post by Kilrathi Avenger » Sat, 18. Aug 07, 19:14

Apologies for the daft question but is this compatible with XTM MOD :?:

Thank You
"As I slide down the banister of life;
my job is just another splinter in the bum"

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Sat, 18. Aug 07, 19:24

As this is a library, it itself use no command, just the xx7777.xml. But if your installing a script using this library, check with the scripter if it script is compatible. If it is, this should work.

As i'm posting here, I add this small update (already the lib your downloading since few weeks ...)
  • 11.08.2007 : 1.1b release
    Image
    New features :
    • Add the 11th menu type
    See above for download and details.
Last edited by PrizzZ on Sat, 18. Aug 07, 19:27, edited 1 time in total.

Kilrathi Avenger
Posts: 275
Joined: Fri, 6. Feb 04, 20:16
x3tc

Post by Kilrathi Avenger » Sat, 18. Aug 07, 19:25

Thanks for the quick reply.
"As I slide down the banister of life;
my job is just another splinter in the bum"

Esraven
Posts: 24
Joined: Tue, 14. Jan 03, 13:58
x3

Post by Esraven » Thu, 23. Aug 07, 12:35

I need to install your engine for the PiloteAI script (http://forum.egosoft.com/viewtopic.php?t=182897)

I have no scripting experience. I always use cycrows package installer to install the scripts

You say I need to install the files in your zipfile to the local game folders.
It is not clear to me which folder or folders you mean.

Suppose I installed X3 to c:\program\x3
Do I unzip your zip file to this folder?
Or are you meaning some subfolder within c:\program\x3. If so which one?

Greetings

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Thu, 23. Aug 07, 12:42

The procedure is :
Extract the lib where you want to.
In the folder where you extract it, there will be two directories :
  • scripts, which contains files that you will copy in your c:\program\x3\scripts folder
  • t, which contains files that you will copy in your c:\program\x3\t folder
Think I'll better make a Cycrow Package .... :gruebel:

User avatar
DeadZone
Posts: 98
Joined: Fri, 26. Sep 03, 09:44
x4

Post by DeadZone » Wed, 19. Sep 07, 03:22

Download doesnt appear to be working at the moment

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Wed, 19. Sep 07, 08:04

Working on this morning.

Esraven
Posts: 24
Joined: Tue, 14. Jan 03, 13:58
x3

Post by Esraven » Mon, 15. Oct 07, 23:14

Thanks for your reply

Greetz

User avatar
Omnicron Lyrae
Posts: 36
Joined: Thu, 1. Dec 05, 21:17

Post by Omnicron Lyrae » Tue, 11. Dec 07, 21:39

Download still isn't working.

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Tue, 11. Dec 07, 21:50

Sorry, should be working now.

Lancefighter
Posts: 3144
Joined: Sun, 19. Dec 04, 02:41
x4

Post by Lancefighter » Tue, 11. Dec 07, 23:42

I like the use of ES's forum pictures (the lines) in your post :D
/me totally does not understand the usefulness of it, as he is not a scripter though...

Just wanted to comlpiment your use of the pictures :D

(btw, you can also steal the download button off the download section, like LV does... ) :wink:

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Wed, 23. Jan 08, 05:41

would it be possible to get this converted to run with the MD incoming question handler? so it doesn't generate log entries? (its not a quick fix it seems cause the MD question handler uses strings and numbers ok, but doesn't pass vars very well)

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Thu, 24. Jan 08, 06:47

well....since I have a need for a working version of this that uses the MD Incoming question handler I've started making one that will work

so far the selectable list has:

Code: Select all

station
station owned by player
ship
ship owned by player
ship or station
ship or station owned by player

sector
object in sector (station ship asteroid)
i still have left to add

Code: Select all

homebase
homebase owned by player
station or carrier to dock at
warpgate
asteroid
ware in sector
ware
station type
station serial
ship type
object class
ware transport class
relation
station and resource
station and product
station and ware
ship and ware
ware of ship
jumpdrive gate
sector position
race
im not going to be doing

Code: Select all

flight retcode
command/signal
script datatype
some of them i need coding suggestions for on how to get them
some of them i may decide not to do

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Thu, 24. Jan 08, 08:35

would this create an array of all flyingwares of the standard ware types in sector?

Code: Select all

* need to pass sector to get from
if $sector == null
$sector = [PLAYERSHIP] -> get sector
end
append "blank entry" to array $dataarray
append "blank entry" to array $textarray

$found = [FALSE] 

$flyingwarearray = find flying ware: sector= $sector maintype= null subtype= null flags= [Find.Multiple] refobj= null maxdist= null maxnum= 2147483647 , refpos= null
$ntype = 8
while $ntype < 17
$total = get number of subtypes of maintype $ntype
$nship = 0
while $nship < $total
$obj = get ware from maintype $ntype and subtype $nship
$worked = [THIS] -> call script "a.a.a.a.iftsos.anoyingcommands" : whatamidoing="index", BPid=$obj, array=$flyingwarearray, offset=0,
if $worked != -1
$obj = $flyingwarearray [ $worked ]
append $obj to array $dataarray
remove element from array $flyingwarearray at index $worked
$txt = sprintf: pageid= 8117 textid= 310 , $obj , null , null , null , null
$txt2 = sprintf: pageid= 8117 textid= 310 , $worked , null , null , null , null
$txt = $txt + ":  " + $txt2
append $txt to array $textarray
$found = [TRUE]
end
if $found == [TRUE] 
$found = [FALSE] 
else
$found = [FALSE] 
inc $nship =
end
end
inc $ntype =

append "" to array $dataarray
append "" to array $textarray

end

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Thu, 24. Jan 08, 13:48

Sorry, I was away from my computer for several days.
But as I do not have a look at the MD, I would be interested in knowing how you send message to player without having a log on the player logbook.

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Fri, 25. Jan 08, 01:22

its all thanks to the Mission Director, there is a script that uses it to send an incoming question, the down side is it can only return strings or numbers (MD limitation)

what i am doing is i already have a script that takes an array and makes each entry in the array into a selection box...that script then call the MD incoming question script gets the answer and passes it back to the first script



so what i have is a few scripts

one generates an array of data and its text equivalent and passes the text to the next one

the next one takes the text and generates a button list and passes that to the MD incoming question script

the MD incoming question script gets the answer and returns it too the second one

which then interprets the info...(if its back or next do that, else pass info back to first script)

info is passed back to the first script and first script converts the text answer back to a data answer useing the "return index of $value in $textarray starting at offset = 0" command

resulting in $answer1 = $textofbuttonpressed
and $answer2 = $datathatisequaltothebuttonpressed

combine them into an array with size 2 and pass that to whatever script called the first script

not simple, but i only have to make one script myself (the one that creates the data and text arrays) - cause i already have the others

wolfmanjack321
Posts: 36
Joined: Wed, 30. Apr 08, 02:56
x3

Post by wolfmanjack321 » Sat, 17. May 08, 01:39

its been a while sense the last post here but....


Your still not clear on where to install this file.


you need to state .. It goes into file X Y Z

IE scripts , Main directory , etc.

"The procedure is :
Extract the lib where you want to.
In the folder where you extract it, there will be two directories :

* scripts, which contains files that you will copy in your c:\program\x3\scripts folder
* t, which contains files that you will copy in your c:\program\x3\t folder"



1. So i can extract it to my Desktop eh?
2. are you saying to put it in the Scripts folder AND the T folder? Or the DL comes with these files you need to move over? Because i just DL this and all it came with was a XML file.

Cheers.

PrizzZ
Posts: 2351
Joined: Sun, 28. Mar 04, 15:56
x3tc

Post by PrizzZ » Sat, 17. May 08, 03:49

This script is installed as any other script : script file in the script folder of the game install, text files in the t folder. In fact I don't really understand what is your point ...

Post Reply

Return to “X³: Reunion - Scripts and Modding”