mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
GFX card profile config file logging moved to debug only
WIP mode of guiSliderCtrl to be a filled rectangle instead of a textured UI Fixed bug with guiTextEditCtrl losing focus updating history passing malformed strings Updated WIP options menu Editor/Project settings WIP Updated editor theme to be consistent, and feed off the editor settings Updated popup menus to reference renamed profiles Added more in-progress modules for examples/stress testing
This commit is contained in:
parent
226529fd1b
commit
f1777016b8
179 changed files with 10144 additions and 415 deletions
|
|
@ -0,0 +1,5 @@
|
|||
$RPGDialogEditorPref::ActionPath = "art/dialogs/dla/";
|
||||
$RPGDialogEditorPref::QuestionPath = "art/dialogs/dlq/";
|
||||
$RPGDialogEditorPref::PortraitsPath = "art/dialogs/portraits/";
|
||||
$RPGDialogEditorPref::mainMod="art";
|
||||
$RPGDialogEditorPref::MaxOptions = 100;
|
||||
1378
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/editorMain.cs
Normal file
1378
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/editorMain.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,57 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function initRPGDialogEditor()
|
||||
{
|
||||
exec("~/scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/EditQuestionGui.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/EditAnswerGui.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/NewScriptPopup.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/SetPathsPopup.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/EditorOpeningGui.gui");
|
||||
|
||||
exec("~/scripts/RPGDialogEditor/defaults.cs");
|
||||
exec("~/scripts/RPGDialogEditor/prefs.cs");
|
||||
exec("~/scripts/RPGDialogEditor/editorMain.cs");
|
||||
|
||||
PopulateActionList();
|
||||
PopulateQuestionOptionsList();
|
||||
GlobalActionMap.bind(keyboard, "f5", toggleRPGDialogEditor);
|
||||
}
|
||||
|
||||
function openRPGDialogEditor()
|
||||
{
|
||||
$GuiBeforeRPGDialogEditor=Canvas.getContent();
|
||||
if(TextScript.getvalue()$="Current Q. Script:")
|
||||
Canvas.setContent(EditorOpeningGui);
|
||||
else
|
||||
Canvas.setContent(MainEditorScreenGui);
|
||||
Canvas.setCursor("DefaultCursor");
|
||||
}
|
||||
|
||||
function closeRPGDialogEditor()
|
||||
{
|
||||
Canvas.setContent($GuiBeforeRPGDialogEditor);
|
||||
Canvas.setCursor("DefaultCursor");
|
||||
}
|
||||
|
||||
|
||||
function toggleRPGDialogEditor(%val)
|
||||
{
|
||||
if (%val)
|
||||
{
|
||||
if (Canvas.getContent() == MainEditorScreenGui.getId() ||
|
||||
Canvas.getContent() == EditQuestionGui.getId() ||
|
||||
Canvas.getContent() == EditAnswerGui.getId() ||
|
||||
Canvas.getContent() == EditorOpeningGui.getId())
|
||||
closeRPGDialogEditor();
|
||||
else
|
||||
openRPGDialogEditor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
68
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/main.cs
Normal file
68
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/main.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function initEditor()
|
||||
{
|
||||
exec("~/scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/EditQuestionGui.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/EditAnswerGui.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/NewScriptPopup.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/SetPathsPopup.gui");
|
||||
exec("~/scripts/RPGDialogEditor/ui/EditorOpeningGui.gui");
|
||||
|
||||
exec("~/scripts/RPGDialogEditor/defaults.cs");
|
||||
exec("~/scripts/RPGDialogEditor/prefs.cs");
|
||||
exec("~/scripts/RPGDialogEditor/editorMain.cs");
|
||||
}
|
||||
|
||||
function startEditor()
|
||||
{
|
||||
// The client mod has already set it's own content, but we'll
|
||||
// just load something new.
|
||||
Canvas.setContent(EditorOpeningGui);
|
||||
Canvas.setCursor("DefaultCursor");
|
||||
PopulateActionList();
|
||||
PopulateQuestionOptionsList();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Package overrides to initialize the mod.
|
||||
// This module currently loads on top of the client mod, but it probably
|
||||
// doesn't need to. Should look into having disabling the client and
|
||||
// doing our own canvas init.
|
||||
|
||||
package RPGDialogEditor {
|
||||
|
||||
function onStart()
|
||||
{
|
||||
Parent::onStart();
|
||||
echo("\n--------- Initializing MOD: RPGDialogEditor ---------");
|
||||
|
||||
if (!isObject(Canvas)) {
|
||||
// If the parent onStart didn't open a canvas, then we're
|
||||
// probably not running as a mod. We'll have to do the work
|
||||
// ourselves.
|
||||
initCanvas("RPGDialog Editor");
|
||||
}
|
||||
initEditor();
|
||||
startEditor();
|
||||
}
|
||||
|
||||
function onExit()
|
||||
{
|
||||
echo("Exporting RPGDialog editor prefs");
|
||||
export("$RPGDialogEditorPref::*", "~/prefs.cs", False);
|
||||
|
||||
if(isEventPending($RPGDialog::RefreshSchedule))
|
||||
cancel($RPGDialog::RefreshSchedule);
|
||||
|
||||
Parent::onExit();
|
||||
}
|
||||
|
||||
}; // package end.
|
||||
activatePackage(RPGDialogEditor);
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
$RPGDialogEditorPref::ActionPath = "art/dialogs/dla/";
|
||||
$RPGDialogEditorPref::mainMod = "art";
|
||||
$RPGDialogEditorPref::MaxOptions = 100;
|
||||
$RPGDialogEditorPref::PortraitsPath = "art/dialogs/portraits/";
|
||||
$RPGDialogEditorPref::QuestionPath = "art/dialogs/dlq/";
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
new GuiChunkedBitmapCtrl(EditAnswerGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
|
||||
new GuiScrollCtrl(AnswerEditScroll) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "40 50";
|
||||
extent = "480 500";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "2 2";
|
||||
|
||||
new GuiMLTextEditCtrl(AnswerEdit) {
|
||||
profile = "GuiMLTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 2";
|
||||
extent = "450 500";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "1";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
|
||||
new GuiTextEditCtrl(ActionEdit) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "40 20";
|
||||
extent = "711 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
};
|
||||
|
||||
new GuiButtonCtrl(AnswerEditConfirmButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "523 530";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "OK";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "confirmAnswerEdit();";
|
||||
};
|
||||
new GuiButtonCtrl(AnswerEditCancelButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "598 530";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "Canvas.setContent(MainEditorScreenGui);";
|
||||
};
|
||||
new GuiButtonCtrl(AnswerEditDeleteButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "673 530";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Delete";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "MessageBoxYesNo( \"Delete Answer\", \"Do you really want to delete this answer?\", \"deleteAnswer(\"@$RPGDialog::EditAnswerNumber@\");\", \"\");";
|
||||
};
|
||||
new GuiScrollCtrl(ActionListScroll) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "521 50";
|
||||
extent = "230 476";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "2 2";
|
||||
|
||||
new GuiTextListCtrl(ActionList) {
|
||||
profile = "GuiTextListProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "196 401";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0";
|
||||
fitParentWidth = "0";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
new GuiChunkedBitmapCtrl(EditQuestionGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
|
||||
new GuiScrollCtrl(QuestionEditScroll) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "40 50";
|
||||
extent = "480 500";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "2 2";
|
||||
|
||||
new GuiMLTextEditCtrl(QuestionEdit) {
|
||||
profile = "GuiMLTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 2";
|
||||
extent = "450 500";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "1";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
new GuiButtonCtrl(QuestionEditConfirmButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "523 530";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "OK";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "confirmQuestionEdit();";
|
||||
};
|
||||
new GuiButtonCtrl(QuestionEditCancelButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "598 530";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "cancelQuestionEdit();";
|
||||
};
|
||||
new GuiButtonCtrl(QuestionEditClearButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "673 530";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Clear";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "QuestionEdit.settext(\"\");QuestionEditSound.setValue(\"\");";
|
||||
};
|
||||
new GuiScrollCtrl(QuestionOptionsScroll) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "521 83";
|
||||
extent = "230 443";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "2 2";
|
||||
|
||||
new GuiTextListCtrl(QuestionOptionsList) {
|
||||
profile = "GuiTextListProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "196 401";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
enumerate = "0";
|
||||
resizeCell = "1";
|
||||
columns = "0";
|
||||
fitParentWidth = "0";
|
||||
clipColumnText = "0";
|
||||
};
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "524 46";
|
||||
extent = "50 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Sound Profile:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(QuestionEditSound) {
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "521 62";
|
||||
extent = "135 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
maxPopupHeight = "500";
|
||||
};
|
||||
|
||||
new GuiButtonCtrl(QuestionEditRemoveSound) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "660 62";
|
||||
extent = "90 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Remove Sound";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "QuestionEditSound.setValue(\"\");";
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(EditorOpeningGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "78 10";
|
||||
extent = "484 160";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
bitmap = "./title";
|
||||
wrap = "0";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiBitmapCtrl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "248 147";
|
||||
extent = "143 186";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
bitmap = "./box";
|
||||
wrap = "0";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiButtonCtrl(NewScriptButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "36 47";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "initNewScript();";
|
||||
text = "New Script";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(LoadScriptButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "36 66";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "getLoadFilename(\"*.dlq\", LoadScript);";
|
||||
text = "Load Script...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(SetPathsButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "36 85";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "initSetPaths();";
|
||||
text = "Set Paths...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiButtonCtrl(QuitButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "36 117";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "MessageBoxYesNo( \"Quit Editor\", \"Do you really want to quit the editor?\", \"if($GuiBeforeRPGDialogEditor==0)quit();else closeRPGDialogEditor();\", \"\");";
|
||||
text = "Quit";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
helpTag = "0";
|
||||
};
|
||||
new GuiTextCtrl(Version) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "bottom";
|
||||
position = "58 18";
|
||||
extent = "26 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
text = "V.1.3";
|
||||
maxLength = "255";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiChunkedBitmapCtrl(MainEditorScreenGui) {
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
bitmap = "./background";
|
||||
useVariable = "0";
|
||||
tile = "0";
|
||||
|
||||
new GuiTextCtrl(TextScript) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "162 21";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Current Q. Script:";
|
||||
maxLength = "255";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(TextScript2) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "162 33";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Current A. Script:";
|
||||
maxLength = "255";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(TextQuestionNumber) {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "162 208";
|
||||
extent = "46 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Question: 0/0";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiButtonCtrl(NewScriptButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "85 52";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "New Script";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "initNewScript();";
|
||||
};
|
||||
new GuiButtonCtrl(LoadScriptButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "85 71";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Load Script...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "getLoadFilename(\"*.dlq\", LoadScript);";
|
||||
};
|
||||
new GuiButtonCtrl(NextQuestionButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "610 212";
|
||||
extent = "29 16";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Next";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "NextQuestion();";
|
||||
};
|
||||
new GuiButtonCtrl(PreviousQuestionButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "579 212";
|
||||
extent = "29 16";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Prev.";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "PreviousQuestion();";
|
||||
};
|
||||
|
||||
new GuiScrollCtrl(QuestionScroll) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "160 50";
|
||||
extent = "480 160";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "4 2";
|
||||
|
||||
new GuiMLTextCtrl(QuestionText) {
|
||||
profile = "GuiMLTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "4 2";
|
||||
extent = "478 116";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "1";
|
||||
maxChars = "-1";
|
||||
};
|
||||
};
|
||||
new GuiScrollCtrl(OptionsScroll) {
|
||||
profile = "GuiScrollProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "10 250";
|
||||
extent = "780 300";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "alwaysOn";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "2 2";
|
||||
|
||||
new GuiControl(OptionsControl) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "4 2";
|
||||
extent = "770 290";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
};
|
||||
};
|
||||
new GuiButtonCtrl(editQuestionButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "642 123";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Edit Question";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "EditQuestion();";
|
||||
};
|
||||
new GuiButtonCtrl(newQuestionButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "642 51";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "New Question";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "newQuestion();";
|
||||
};
|
||||
new GuiButtonCtrl(newAnswerButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "715 230";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "New Answer";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "newAnswer();";
|
||||
};
|
||||
new GuiButtonCtrl(DeleteQuestionButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "642 76";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Del. Question";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "if($RPGDialog::Questions>0) MessageBoxYesNo( \"Delete Question\", \"Do you really want to delete this question?\", \"deleteQuestion();\", \"\");";
|
||||
};
|
||||
new GuiButtonCtrl(QuitButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "85 192";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Quit";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "MessageBoxYesNo( \"Quit Editor\", \"Do you really want to quit the editor?\", \"if($GuiBeforeRPGDialogEditor==0)quit();else closeRPGDialogEditor();\", \"\");";
|
||||
};
|
||||
new GuiButtonCtrl(SaveScriptButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "85 103";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Save Script";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "SaveScript();";
|
||||
};
|
||||
new GuiButtonCtrl(SaveScriptAsButton) {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "85 122";
|
||||
extent = "73 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Save As...";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
command = "InitSaveAsPhase1();";
|
||||
};
|
||||
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(NewScriptPopup) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "220 146";
|
||||
extent = "200 188";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "New Dialog Script";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "0";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 28";
|
||||
extent = "50 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Question Script:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(NewScriptQuestion) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 44";
|
||||
extent = "160 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 68";
|
||||
extent = "30 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Action Script:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(NewScriptAction) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 84";
|
||||
extent = "160 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "56 156";
|
||||
extent = "40 16";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "NewScript();";
|
||||
helpTag = "0";
|
||||
text = "Create";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "104 156";
|
||||
extent = "40 16";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "Canvas.popDialog(NewScriptPopup);";
|
||||
helpTag = "0";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new GuiControl(SetPathsPopup) {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
profile = "GuiWindowProfile";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
position = "220 146";
|
||||
extent = "200 228";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Paths";
|
||||
maxLength = "255";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "0";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 24";
|
||||
extent = "67 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Main Mod Folder:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(MainMod) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 40";
|
||||
extent = "160 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 64";
|
||||
extent = "101 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Question Script Path:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(QuestionScriptPath) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 80";
|
||||
extent = "160 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 104";
|
||||
extent = "89 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Action Script Path:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(ActionScriptPath) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 120";
|
||||
extent = "160 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
profile = "GuiTextProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 144";
|
||||
extent = "67 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
text = "Portraits Path:";
|
||||
maxLength = "255";
|
||||
};
|
||||
new GuiTextEditCtrl(PortraitsPath) {
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "20 160";
|
||||
extent = "160 18";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
maxLength = "255";
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "56 192";
|
||||
extent = "40 16";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "SetPaths();";
|
||||
helpTag = "0";
|
||||
text = "Set";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
profile = "GuiButtonProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "104 192";
|
||||
extent = "40 16";
|
||||
minExtent = "8 2";
|
||||
visible = "1";
|
||||
command = "Canvas.popDialog(SetPathsPopup);";
|
||||
helpTag = "0";
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 149 KiB |
BIN
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/box.png
Normal file
BIN
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/box.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
BIN
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/title.png
Normal file
BIN
Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/title.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
205
Templates/Modules/RPGDialog/Scripts/client/RPGDialog.cs
Normal file
205
Templates/Modules/RPGDialog/Scripts/client/RPGDialog.cs
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// RPGDialog - Presents the player with a question and several answers to select from
|
||||
// Created by Nelson A. K. Gonsalves
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
if($RPGDialogEditorPref::MaxOptions>0)
|
||||
$Pref::RPGDialog::MaxOptions=$RPGDialogEditorPref::MaxOptions;
|
||||
|
||||
function getQuestion(%questionFile,%questionNumber)
|
||||
{
|
||||
%file = new FileObject();
|
||||
if(isFile($Pref::RPGDialog::Client::QuestionPath@%questionFile@".dlq") && %file.openForRead($Pref::RPGDialog::Client::QuestionPath@%questionFile@".dlq"))
|
||||
{
|
||||
for(%i=1;%i<%questionNumber;%i++)
|
||||
{
|
||||
%file.readLine();
|
||||
if(%file.isEOF())
|
||||
return "<Invalid Question>";
|
||||
}
|
||||
%question=%file.readLine();
|
||||
}
|
||||
else if(isFile($RPGDialogEditorPref::QuestionPath@%questionFile@".dlq") && %file.openForRead($RPGDialogEditorPref::QuestionPath@%questionFile@".dlq"))
|
||||
{
|
||||
for(%i=1;%i<%questionNumber;%i++)
|
||||
{
|
||||
%file.readLine();
|
||||
if(%file.isEOF())
|
||||
return "<Invalid Question>";
|
||||
}
|
||||
%question=%file.readLine();
|
||||
}
|
||||
%file.close();
|
||||
%file.delete();
|
||||
return %question;
|
||||
}
|
||||
|
||||
function clientCmdCloseRPGDialog()
|
||||
{
|
||||
Canvas.popDialog(RPGDialog);
|
||||
RPGDialogQuestion.settext("");
|
||||
RPGDialogAnswer.settext("");
|
||||
}
|
||||
|
||||
function clientCmdRPGDialogMessage(%sender,%senderName,%portrait,%npcFile,%questionNumber,%playerName)
|
||||
{
|
||||
$RPGDialog::Sender=%sender;
|
||||
$RPGDialog::questionNumber=%questionNumber;
|
||||
onRPGDialogMessage(%npcFile,%questionNumber,%senderName,%portrait,%playerName);
|
||||
}
|
||||
|
||||
function onRPGDialogMessage(%npcFile,%questionNumber,%senderName,%portrait,%playerName)
|
||||
{
|
||||
if(%portrait!$="" && isFile($RPGDialogEditorPref::PortraitsPath@%portrait))
|
||||
{
|
||||
RPGDialogPortrait.setbitmap($RPGDialogEditorPref::PortraitsPath@%portrait);
|
||||
}
|
||||
else
|
||||
{
|
||||
RPGDialogPortrait.setbitmap($RPGDialogEditorPref::PortraitsPath@"unknown.png");
|
||||
}
|
||||
|
||||
if(%npcFile!$="")
|
||||
{
|
||||
%QuestionAnswer=GetQuestion(%npcfile,%questionNumber);
|
||||
|
||||
if(%QuestionAnswer!$="<InvalidQuestion>")
|
||||
{
|
||||
%AnswerStart=strPos(%QuestionAnswer,"<AnswerStart>");
|
||||
%question=getSubStr(%QuestionAnswer,0,%AnswerStart);
|
||||
%answer=getSubStr(%QuestionAnswer,%AnswerStart+13,strLen(%QuestionAnswer));
|
||||
}
|
||||
else
|
||||
{
|
||||
%question="ERROR::Invalid Question!!\nnpcFile = "@%npcFile@"\nquestionNumber = "@%questionNumber;
|
||||
}
|
||||
}
|
||||
|
||||
if (%question!$="")
|
||||
{
|
||||
%question=strreplace(%question,"<<Name>>",%senderName);
|
||||
%question=strreplace(%question,"<<PlayerName>>",%playerName);
|
||||
|
||||
|
||||
if ((%soundStart = playRPGDialogSound(%question)) != -1)
|
||||
%question = getSubStr(%question, 0, %soundStart);
|
||||
|
||||
RPGDialogQuestion.settext(%question);
|
||||
ChatHud.addLine($Pref::RPGDialog::ChatHudQuestionColor@%senderName@": "@StripMLControlChars(%question));
|
||||
}
|
||||
|
||||
if (%answer!$="")
|
||||
{
|
||||
%answer=strReplace(%answer,"<<Name>>",%senderName);
|
||||
%answer=strReplace(%answer,"<<PlayerName>>",%playerName);
|
||||
%answer=strReplace(%answer,"<BR>","\n");
|
||||
|
||||
%line=%answer;
|
||||
%i=1;
|
||||
while(%i<=$Pref::RPGDialog::MaxOptions) //lets number the options
|
||||
{
|
||||
%Start=strpos(%line,"<a:RPGDialog "@%i@">");
|
||||
|
||||
if(%Start<0)
|
||||
{
|
||||
%i=$Pref::RPGDialog::MaxOptions+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
%line=getSubStr(%line,%Start,strlen(%line));
|
||||
%End=strpos(%line,"</a>")+4;
|
||||
%line=getSubStr(%line,%End,strlen(%line));
|
||||
%answer=strReplace(%answer,"<a:RPGDialog "@%i@">","<a:RPGDialog "@%i@"> "@%i@" - ");
|
||||
%i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RPGDialogAnswer.settext(%answer);
|
||||
}
|
||||
else
|
||||
{
|
||||
RPGDialogAnswer.settext("<a:RPGDialogNoAnswer>Continue...");
|
||||
}
|
||||
RPGDialogAnswer.Visible=true;
|
||||
|
||||
Canvas.pushDialog(RPGDialog);
|
||||
}
|
||||
|
||||
function RPGDialogAnswer::onURL(%this, %url)
|
||||
{
|
||||
//same as RPGDialogQuestion::onURL, so just forward the call
|
||||
RPGDialogQuestion::onURL(%this, %url);
|
||||
}
|
||||
|
||||
function RPGDialogQuestion::onURL(%this, %url)
|
||||
{
|
||||
if(firstword(%url)!$="RPGDialog" && firstword(%url)!$="RPGDialogLink" && firstword(%url)!$="RPGDialogNoAnswer")
|
||||
{
|
||||
gotoWebPage( %url );
|
||||
}
|
||||
else if(firstword(%url)$="RPGDialogLink")
|
||||
{
|
||||
%Answers=%this.gettext();
|
||||
%AnswerHeaderSize=strlen("<a:RPGDialogLink "@restwords(%url)@">");
|
||||
%AnswerStart=strpos(%Answers,"<a:RPGDialogLink "@restwords(%url)@">")+%AnswerHeaderSize;
|
||||
%Answers=getSubStr(%Answers,%AnswerStart,strLen(%Answers));
|
||||
%AnswerEnd=strPos(%Answers,"</a>")+4;
|
||||
|
||||
ChatHud.addLine($Pref::RPGDialog::ChatHudAnswerColor@"You: "@StripMLControlChars(getSubStr(%Answers,0,%AnswerEnd)));
|
||||
|
||||
CommandToServer('RPGDialogAnswer', $RPGDialog::Sender, $RPGDialog::questionNumber, "QL"@restwords(%url));
|
||||
|
||||
Canvas.popDialog(RPGDialog);
|
||||
RPGDialogQuestion.settext("");
|
||||
RPGDialogAnswer.settext("");
|
||||
}
|
||||
else if(firstword(%url)$="RPGDialogNoAnswer")
|
||||
{
|
||||
Canvas.popDialog(RPGDialog);
|
||||
RPGDialogQuestion.settext("");
|
||||
RPGDialogAnswer.settext("");
|
||||
}
|
||||
else
|
||||
{
|
||||
%Answers=%this.gettext();
|
||||
%Answers=strReplace(%Answers,restwords(%url)@" - ","");
|
||||
%AnswerHeaderSize=strlen("<a:RPGDialog "@restwords(%url)@">");
|
||||
%AnswerStart=strpos(%Answers,"<a:RPGDialog "@restwords(%url)@">")+%AnswerHeaderSize;
|
||||
%Answers=getSubStr(%Answers,%AnswerStart,strLen(%Answers));
|
||||
%AnswerEnd=strpos(%Answers,"</a>")+4;
|
||||
|
||||
ChatHud.addLine($Pref::RPGDialog::ChatHudAnswerColor@"You: "@StripMLControlChars(getSubStr(%Answers,0,%AnswerEnd)));
|
||||
|
||||
CommandToServer('RPGDialogAnswer', $RPGDialog::Sender, $RPGDialog::questionNumber, restwords(%url));
|
||||
|
||||
Canvas.popDialog(RPGDialog);
|
||||
RPGDialogQuestion.settext("");
|
||||
RPGDialogAnswer.settext("");
|
||||
}
|
||||
}
|
||||
|
||||
function playRPGDialogSound(%message)
|
||||
{
|
||||
// Search for wav tag marker.
|
||||
%soundStart = strstr(%message, "~Sound:");
|
||||
if (%soundStart == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(alxIsPlaying($RPGDialogSoundHandle))
|
||||
alxStop($RPGDialogSoundHandle);
|
||||
|
||||
%sound = getSubStr(%message, %soundStart + 7, strLen(%message));
|
||||
$RPGDialogSoundHandle = alxPlay(%sound);
|
||||
|
||||
return %soundStart;
|
||||
}
|
||||
|
||||
function SelectAnswer(%Number)
|
||||
{
|
||||
if(strPos(RPGDialogAnswer.getText(),"<a:RPGDialog "@%Number@">")>=0)
|
||||
RPGDialogAnswer.onURL("RPGDialog "@%Number);
|
||||
else
|
||||
OutOfRPGDialogFunction(%Number);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
new SFXDescription(DialogSound)
|
||||
{
|
||||
volume = 1.2;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = $MessageAudioType;
|
||||
};
|
||||
|
||||
new SFXProfile(test)
|
||||
{
|
||||
filename = "art/dialogs/sounds/test.wav";
|
||||
description = "DialogSound";
|
||||
preload = false;
|
||||
};
|
||||
|
||||
new SFXProfile(test2)
|
||||
{
|
||||
filename = "art/dialogs/sounds/test2.wav";
|
||||
description = "DialogSound";
|
||||
preload = false;
|
||||
};
|
||||
341
Templates/Modules/RPGDialog/Scripts/server/RPGDialog.cs
Normal file
341
Templates/Modules/RPGDialog/Scripts/server/RPGDialog.cs
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// RPGDialog - Presents the player with a question and several answers to select from
|
||||
// Created by Nelson A. K. Gonsalves
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function getAction(%actionFile,%questionNumber)
|
||||
{
|
||||
%file = new FileObject();
|
||||
if(isFile($Pref::Server::RPGDialog::ActionPath@%actionFile@".dla") && %file.openForRead($Pref::Server::RPGDialog::ActionPath@%actionFile@".dla"))
|
||||
{
|
||||
for(%i=1;%i<%questionNumber;%i++)
|
||||
{
|
||||
%file.readLine();
|
||||
if(%file.isEOF())
|
||||
return "<Invalid Question>";
|
||||
}
|
||||
%action=%file.readLine();
|
||||
}
|
||||
else if(isFile($RPGDialogEditorPref::ActionPath@%actionFile@".dla") && %file.openForRead($RPGDialogEditorPref::ActionPath@%actionFile@".dla"))
|
||||
{
|
||||
for(%i=1;%i<%questionNumber;%i++)
|
||||
{
|
||||
%file.readLine();
|
||||
if(%file.isEOF())
|
||||
return "<Invalid Question>";
|
||||
}
|
||||
%action=%file.readLine();
|
||||
}
|
||||
|
||||
%file.close();
|
||||
%file.delete();
|
||||
return %action;
|
||||
}
|
||||
|
||||
function RPGDialogMessageClient(%client,%sender,%npcFile,%questionNumber)
|
||||
{
|
||||
%senderName=%sender.getshapename();
|
||||
%portrait=%sender.RPGDialogPortrait;
|
||||
%playerName=%client.player.getshapename();
|
||||
|
||||
%sender.RPGDialogBusy=true;
|
||||
%sender.RPGDialogTalkingTo=%client;
|
||||
%sender.setAimObject(%client.player);
|
||||
|
||||
commandToClient(%client,'RPGDialogMessage',%sender,%senderName,%portrait,%npcFile,%questionNumber,%playerName);
|
||||
|
||||
CheckRPGDialogStatus(%client,%sender);
|
||||
}
|
||||
|
||||
function serverCmdRPGDialogAnswer(%client,%sender,%questionNumber,%answerNumber)
|
||||
{
|
||||
if(%client==%sender.RPGDialogTalkingTo)
|
||||
{
|
||||
%npcFile=%sender.RPGDialogScript;
|
||||
|
||||
%Actions=GetAction(%npcFile,%questionNumber);
|
||||
|
||||
if(%Actions!$="<InvalidQuestion>")
|
||||
{
|
||||
%ActionHeaderSize=strlen("<"@%answerNumber@">");
|
||||
%ActionStart=strPos(%Actions,"<"@%answerNumber@">")+%ActionHeaderSize;
|
||||
%Actions=getSubStr(%Actions,%ActionStart,strlen(%Actions));
|
||||
%ActionEnd=strPos(%Actions,"<END>");
|
||||
|
||||
if(%ActionEnd==-1)
|
||||
return;
|
||||
|
||||
%Actions=getSubStr(%Actions,0,%ActionEnd);
|
||||
|
||||
while(%Actions!$="")
|
||||
{
|
||||
%ParamStart=strPos(%Actions,"(")+1;
|
||||
%ParamEnd=strPos(%Actions,")")-%ParamStart;
|
||||
%Param=getSubStr(%Actions,%ParamStart,%ParamEnd);
|
||||
|
||||
%Action=getSubStr(%Actions,0,%ParamStart-1);
|
||||
if(%Param!$="")
|
||||
{
|
||||
eval(%Action@"("@%Param@","@%client@","@%sender@",\""@%npcFile@"\");");
|
||||
}
|
||||
else
|
||||
{
|
||||
eval(%Action@"("@%client@","@%sender@",\""@%npcFile@"\");");
|
||||
}
|
||||
%Actions=getSubStr(%Actions,strlen(%Action)+%ParamEnd+2,strlen(%Actions));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo("ERROR::Invalid Question/Answer!!\nnpcFile = "@%npcFile@"\nquestionNumber = "@%questionNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function serverCmdRPGDialogRay(%client)
|
||||
{
|
||||
%StartPos=%client.player.gettransform();
|
||||
%Eye = %client.player.getEyeVector();
|
||||
%EndPos = vectorScale(%Eye, -1);
|
||||
%EndPos = vectorsub(%StartPos,%EndPos);
|
||||
|
||||
InitContainerRadiusSearch(%EndPos, 2.5, $TypeMasks::PlayerObjectType);
|
||||
|
||||
%rayCast=ContainerSearchNext();
|
||||
while(%rayCast != 0 )
|
||||
{
|
||||
if(%rayCast.RPGDialogScript!$="")
|
||||
{
|
||||
if(!%rayCast.RPGDialogBusy)
|
||||
{
|
||||
RPGDialogMessageClient(%client, %rayCast, %rayCast.RPGDialogScript,%rayCast.RPGDialogStartQuestion); //start dialog.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(IsRPGDialogBusy(%rayCast))
|
||||
{
|
||||
if(%client!=%raycast.RPGDialogTalkingTo)
|
||||
{
|
||||
messageClient(%client, '', %rayCast.RPGDialogBusyText, %raycast.RPGDialogTalkingTo.player.getShapeName());
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
RPGDialogMessageClient(%client, %rayCast, %rayCast.RPGDialogScript,%rayCast.RPGDialogStartQuestion); //start dialog.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
%rayCast=ContainerSearchNext();
|
||||
}
|
||||
}
|
||||
|
||||
function IsRPGDialogBusy(%AiPlayerID)
|
||||
{
|
||||
InitContainerRadiusSearch(%AiPlayerID.getTransform(), 5, $TypeMasks::PlayerObjectType);
|
||||
%rayCastBusyCheck=ContainerSearchNext();
|
||||
while(%rayCastBusyCheck != 0 )
|
||||
{
|
||||
if(%rayCastBusyCheck==(%AiPlayerID.RPGDialogTalkingTo).player)
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
%rayCastBusyCheck=ContainerSearchNext();
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
function CheckRPGDialogStatus(%Client,%Sender) //Checks if the player has moved since he started the dialog, moving too far from the sender will cancel the dialog
|
||||
{
|
||||
InitContainerRadiusSearch(%Sender.getTransform(), 5, $TypeMasks::PlayerObjectType);
|
||||
%rayCast=ContainerSearchNext();
|
||||
while(%rayCast != 0 )
|
||||
{
|
||||
if(%rayCast==%Client.player)
|
||||
{
|
||||
schedule(1000,0,"CheckRPGDialogStatus",%Client,%Sender);
|
||||
return;
|
||||
}
|
||||
%rayCast=ContainerSearchNext();
|
||||
}
|
||||
CommandToClient(%client,'CloseRPGDialog');
|
||||
%Sender.RPGDialogBusy=false;
|
||||
%Sender.RPGDialogTalkingTo=0;
|
||||
%Sender.clearAim();
|
||||
}
|
||||
|
||||
function SpawnTestNPC()
|
||||
{
|
||||
%player = AIPlayer::spawn("a test NPC","359.973 304.759 217.766");
|
||||
%player.RPGDialogScript = "Test";
|
||||
%player.RPGDialogPortrait = "Test.png";
|
||||
%player.RPGDialogStartQuestion = 1;
|
||||
%player.RPGDialogBusy = false;
|
||||
%player.RPGDialogBusyText = 'Sorry but I\'m busy talking to %1 right now.';
|
||||
%player.RPGDialogTalkingTo = 0;
|
||||
|
||||
return %player;
|
||||
}
|
||||
|
||||
function SpawnNPC(%Name,%Script,%Portrait,%startQuestion,%location)
|
||||
{
|
||||
%player = AIPlayer::spawn(%Name,%location);
|
||||
%player.RPGDialogScript = %Script;
|
||||
%player.RPGDialogPortrait = %Portrait;
|
||||
%player.RPGDialogStartQuestion = %startQuestion;
|
||||
%player.RPGDialogBusy = false;
|
||||
%player.RPGDialogBusyText = 'Sorry but I\'m busy talking to %1 right now.';
|
||||
%player.RPGDialogTalkingTo = 0;
|
||||
|
||||
return %player;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// RPGDialog Script Functions - functions bellow are made to be used by the
|
||||
// dialog scripts.
|
||||
// The commented out lines that start with <ActionList> are used when populating the action
|
||||
// list on the RPGDialog Editor.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//<ActionList>GotoQuestion(QuestionNumber)
|
||||
function GotoQuestion(%questionNumber,%client,%sender,%npcFile)
|
||||
{
|
||||
RPGDialogMessageClient(%client, %sender, %npcFile, %questionNumber);
|
||||
}
|
||||
|
||||
//<ActionList>CloseDialog()
|
||||
function CloseDialog(%client,%sender,%npcFile)
|
||||
{
|
||||
//sendind nothing to the client will close the dialog without anything else happening
|
||||
%sender.RPGDialogBusy=false;
|
||||
%sender.RPGDialogTalkingTo=0;
|
||||
}
|
||||
|
||||
//<ActionList>MoveTo(Position)
|
||||
function MoveTo(%position,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.setAimLocation(%position);
|
||||
%sender.setMoveDestination(%position);
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>KillPlayer()
|
||||
function KillPlayer(%client,%sender,%npcFile)
|
||||
{
|
||||
%client.player.kill("Sudden");
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>KillSender()
|
||||
function KillSender(%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.kill("Sudden");
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>DamagePlayer(Amount)
|
||||
function DamagePlayer(%DamageAmount,%client,%sender,%npcFile)
|
||||
{
|
||||
%client.player.damage(0, %sender.getposition(), %damageAmount, "Sudden");
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>DamageSender(Amount)
|
||||
function DamageSender(%DamageAmount,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.damage(0, %sender.getposition(), %damageAmount, "Sudden");
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>TeleportPlayer(Position)
|
||||
function TeleportPlayer(%Pos,%client,%sender,%npcFile)
|
||||
{
|
||||
%client.player.setTransform(%Pos);
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>TeleportSender(Position)
|
||||
function TeleportSender(%Pos,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.setTransform(%Pos);
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>RenamePlayer(NewName)
|
||||
function RenamePlayer(%NewName,%client,%sender,%npcFile)
|
||||
{
|
||||
messageAllExcept(%client, -1, 'MsgPlayerRenamed', '\c1%1 is now known as %2.',%client.player.getshapeName(),%NewName);
|
||||
messageClient(%client, 'MsgPlayerRenamed', '\c1You are now known as %1.',%NewName);
|
||||
%client.player.setshapeName(%NewName);
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>RenameSender(NewName)
|
||||
function RenameSender(%NewName,%client,%sender,%npcFile)
|
||||
{
|
||||
messageAll('MsgAIRenamed','\c1%1 is now known as %2.',%sender.getshapename(),%NewName);
|
||||
%sender.setshapeName(%NewName);
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>ChangeStartQuestion(QuestionNumber)
|
||||
function ChangeStartQuestion(%NewQuestion,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.RPGDialogStartQuestion=%NewQuestion;
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>ChangeStartQuestionAndOpen(QuestionNumber)
|
||||
function ChangeStartQuestionAndOpen(%NewQuestion,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.RPGDialogStartQuestion=%NewQuestion;
|
||||
RPGDialogMessageClient(%client, %sender, %sender.RPGDialogScript,%NewQuestion);
|
||||
}
|
||||
|
||||
//<ActionList>ChangeStartQuestionAndGoto(StartQuestion,GotoQuestion)
|
||||
function ChangeStartQuestionAndGoto(%NewStartQuestion,%GoTo,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.RPGDialogStartQuestion=%NewQuestion;
|
||||
RPGDialogMessageClient(%client, %sender, %sender.RPGDialogScript,%GoTo);
|
||||
}
|
||||
|
||||
//<ActionList>ChangeScript(ScriptName,QuestionNumber)
|
||||
function ChangeScript(%NewScript,%StartQuestion,%client,%sender,%npcFile)
|
||||
{
|
||||
if(%NewScript!$="" && isFile($RPGDialogEditorPref::ActionPath@%NewScript@".dla"))
|
||||
{
|
||||
%sender.RPGDialogScript=%NewScript;
|
||||
%sender.RPGDialogStartQuestion=%StartQuestion;
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
}
|
||||
|
||||
//<ActionList>ChangeScriptAndOpen(ScriptName,QuestionNumber)
|
||||
function ChangeScriptAndOpen(%NewScript,%StartQuestion,%client,%sender,%npcFile)
|
||||
{
|
||||
|
||||
if(%NewScript!$="" && isFile($RPGDialogEditorPref::ActionPath@%NewScript@".dla"))
|
||||
{
|
||||
%sender.RPGDialogScript=%NewScript;
|
||||
%sender.RPGDialogStartQuestion=%StartQuestion;
|
||||
RPGDialogMessageClient(%client, %sender, %NewScript,%StartQuestion);
|
||||
}
|
||||
}
|
||||
|
||||
//<ActionList>ChangePortrait(NewPortrait)
|
||||
function ChangePortrait(%NewPortrait,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.RPGDialogPortrait=%NewPortrait;
|
||||
CloseDialog(%client,%sender,%npcFile);
|
||||
}
|
||||
|
||||
//<ActionList>ChangePortraitAndGoto(NewPortrait,QuestionNumber)
|
||||
function ChangePortraitAndGoto(%NewPortrait,%QuestionNumber,%client,%sender,%npcFile)
|
||||
{
|
||||
%sender.RPGDialogPortrait=%NewPortrait;
|
||||
RPGDialogMessageClient(%client, %sender, %sender.RPGDialogScript,%QuestionNumber);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue