A quick guide to sending an incoming question to a Player for experienced X2 script writers
Code: Select all
<t id="2">[u][author][b]%s[/b][/author] My ship %s needs an escort to %s. I'll pay you %s credits if you will escort me[/u]\n
[select value="yes"]Yes I will Protect You[/select]\n
[select value="no"]No[/select]\n
</t>
Code: Select all
[select value="killme"]Please Kill me[/select]\n
[select value="irepent"]You'll Never Take Me Alive, copper![/select]\n
Next we call the handler script
Code: Select all
$m = sprintf: pageid=5497 textid=2, $pilotname, $shipname, $destination, $offer, null
094 send incoming question $m to player: callback='plugin.escort.me.reply'
This is the script where the [select value="yes"]Yes I will Protect You[/select] returns your choice to.
Code: Select all
Script plugin.escort.me.reply
Version: 0
for Script Engine Version: 28
Description
Description
Arguments
1: val , Var/String , 'val'
Source Text
001 if $val == 'yes'
002 set global variable: name='lv.escort.me' value=1
003 else if $val == 'no'
004 set global variable: name='lv.escort.me' value=2
005 end
Code: Select all
if $val == 'yes'
For the purpose of my script the choice is a global variable switch that is checked from another script a few seconds later for the answer, You can run scripts from in here and do all sorts of other code it is just the initail variable that matters.
--------------------------------------------------------
I'll be uploading the escort script within the next couple of days so feel free to use the code as a template once I upload it.
LV