SRL Archive - RS3 Intermediate Scripting Tutorials

How to add the SRL Player Form to your script


Coh3n

2014-01-12 12:32:33

How to add the SRL Player Form to your script





Introduction

[INDENT]
Hello! I am going to teach you how to add the new SRL player form (SPF) to any script. The SPF is a very customizable user interface that helps script users setup your script. You can have as many or as few player settings as you wish, as well has some other optional properties. I highly recommend adding the SPF to all your scripts - it's simple and makes setting up your script much easier for users. Please read this guide carefullly; it may be confusing.

This guide assumes you have a decent knowledge of arrays and custom records.
[/INDENT]

Features

[INDENT]
As stated above, there is a lot of room for customization. If you'd like a feature added, please suggest it here.

Features:

  • Automatically loads all user's player files into the "Player File" combo box.
  • Automatically loads a user's previous settings.
  • Scripters can have as many TEdits, TComboBoxes, and TCheckBoxes as they wish.
  • Scripters have the option to set default values for each of the above components.
  • The PlayerForm variable has several attributes that can be customized by the scripter.

[/INDENT]

Added SPF to a script

[INDENT]
The SPF can be added to any script in a few easy steps:

  1. Include the Simba file in your script.
  2. Create the SPF init() procedure.
  3. Create the modified decalarePlayers() procedure.
  4. Debug the results (optional)!
  5. Call runPlayerForm() in your mainloop.

Including it in your script[INDENT]
Very simple step, just add the following to the top of your script:

program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba} // include the file AFTER srl.simba
[/INDENT]

Create the SPF init() procedure[INDENT]
This is the procedure that declares the SPF settings. In this procedure, you're modifying the "playerForm" variable to your liking. Here's an example procedure explained:


// initiates the SRL player form (you aren't restricted to the procedure name; it can be whatever you want)
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'SRL Player Form ~ Test'; // the title of the SPF, usually the name of your script
scriptHelpThread := ''; // a link to a help thread, if set to '' will link to my setup guide

editBoxLabels := ['Minutes to run', 'Logs to Chop', 'Minutes before breaking']; // edit boxes are created for each array element
editBoxDefaults := ['0', '0', '0']; // optional default values for each edit box; array length must equal editBoxLabel length

// optional hints for each edit box; hints are shown when the user holds the mouse over the component
editBoxHints := ['How long to run (in minutes)?', 'How many logs do you want to chop?', 'Run for this amount of time (in minutes) before breaking.'];

checkBoxLabels := ['Hatchet Equipped', 'Save SRL log', 'Draw on SMART']; // same as editBoxLabels but for check boxes
checkBoxDefaults := ['True', 'True', 'False'];
checkBoxHints := ['Is your hatchet equipped?', 'Do you want to save SRL debug to a log file (recommended)?', 'Do you want do draw some debug information on SMART?'];

comboBoxLabels := ['Tree Type']; // same as editBoxLabels but for combo boxes (drop down boxes)
comboBoxDefaults := ['Willow'];
comboBoxHints := ['Choose the type of tree you want to chop.'];

// this needs to be done for every element in the comboBoxLabels array
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Normal', 'Oak', 'Willow', 'Maple', 'Yew', 'Magic']; // all the options available for the first combo box
end;
end;
Once the SPF has run, it will set an array of settings (TStringArray) for each player. The order goes by the UI components declared in the above procedure. For example, the "Minutes to run" setting is element 0, "Minutes before breaking" is element 2, and "Tree Type" is element 6. You want to make sure you use these correctly in the modified declarePlayers() procedure.


[/INDENT]

Create the modified declarePlayers() procedure[INDENT]
This procedure is essential, and I highly recommend debugging player information when you think you're finished. This is the procedure that sets all player information based on an array from the SPF. You don't want to accidentally set a player setting to the wrong data. The player's settings are stored in the "playerForm.players.settings" variable.

The key to this procedure is properly accessing the player's settings that were set by the SPF. Each player will have an array of settings associated with them that were set in the SPF. These settings are all in strings, so they need to be converted when you set different typed attributes. Here's an example explained:


// again, not restricted to the procedure name, although it's recommended
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first

// set player attributes based on the settings from the form
for i := 0 to high(players) do
with players[i] do
begin
// convert the integers
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);

// booleans
booleans[0] := strToBool(playerForm.players[i].settings[3]);
booleans[1] := strToBool(playerForm.players[i].settings[4]);
booleans[2] := strToBool(playerForm.players[i].settings[5]);

// strings
strings[0] := playerForm.players[i].settings[6];

// any other data types you've decided to use
end;
end;


[/INDENT]

Debug the results (optional)[INDENT]
Although optional, it is highly recommended. This ensures that everything was properly set in your modified declarePlayers() procedure. Here's an example debug procedure for the above SPF:


procedure debugSPFSettings();
var
i: integer;
begin
writeln('');

for i := 0 to high(players) do
begin
writeln('Minutes to run: ', players[i].integers[0]);
writeln('Logs to chop: ', players[i].integers[1]);
writeln('Minutes before breaking: ', players[i].integers[2]);
writeln('Hatchet Equipped: ', players[i].booleans[0]);
writeln('Save SRL log: ', players[i].booleans[1]);
writeln('Draw on SMART: ', players[i].booleans[2]);
writeln('Tree Type: ', players[i].strings[0]);
writeln('');
end;
end;
This will yield an output that looks something like:

Minutes to run: 0
Logs to chop: 6000
Minutes before breaking: 70
Hatchet Equipped: True
Save SRL log: False
Draw on SMART: True
Tree Type: Willow


[/INDENT]

Call runPlayerForm() in your mainloop[INDENT]
Another important step. If you don't do this, nothing will work. :p You simply need to call the correct procedures before setupSRL() and you're good to go. Example:


begin
clearDebug();

initPlayerForm(); // initiate your settings
runPlayerForm(); // run the form

// use this so the script doesn't continue if the user exits out of the form
if (not playerForm.isScriptReady) then
exit;

declarePlayers();
debugSPFSettings(); // this can be removed if you're satisfied with the result
setupSRL();
end.


[/INDENT]

Conclusion

[INDENT]
I hope this was easy enough to understand. If you have any questions and/or concerns, please feel free to post here and I will help you out the best I can. I have also attached the complete example script if you'd like to use test it.

Cheers,
Coh3n
[/INDENT]
[/INDENT]

rj

2014-01-12 12:54:14

Question: is the form done plugin sided? (AKA still no forms for lape?)

Ashaman88

2014-01-12 13:12:21

If you setup the form and run it once, save those settings. Then add a new setting in the script you get an out of range error, causing you to have to delete the old settings file before being able to run the script again. Would be bad for scripts that add features over time.


Olly

2014-01-12 13:12:48

No it's done in lape. Lape forms are pretty basic, bad syntax (i think :p) and you cant use mml.

Coh3n

2014-01-12 13:16:15

From: Officer Barbrady
Question: is the form done plugin sided? (AKA still no forms for lape?)

Like Olly said, Lape supports basic forms. You can check out the code here https://github.com/SRL/SRL-6/blob/master/lib/misc/srlplayerform.simba.

From: Ashaman88
If you setup the form and run it once, save those settings. Then add a new setting in the script you get an out of range error, causing you to have to delete the old settings file before being able to run the script again. Would be bad for scripts that add features over time.

Oh nice, good find. I'll try to fix that now. E: Fixed. If this happens it won't load previous settings. Not ideal, but the alternative isn't really feasible right now.

Ashaman88

2014-01-12 13:33:34

From: Coh3n
Like Olly said, Lape supports basic forms. You can check out the code here https://github.com/SRL/SRL-6/blob/master/lib/misc/srlplayerform.simba.

Oh nice, good find. I'll try to fix that now.


Also, I'm not sure if I'm setting something up wrong, but when I run the form for the first time (w/o settings file), I have a drop down for the Player file, but when I select my player file none of my players populate (it may not be designed to do that idk). However when I add a player manually in the box to the left, Player1, fill out the rest of the settings, save, then hit run I get:


You have the latest version of the script!
-- TPlayerArray.setup()
---- ERROR: Couldn't find army file()
-- TPlayerArray.setup(): false
-- Freeing the minimap mask

but when i hit play again, my saved settings pop up - so I hit run

-- TPlayerArray.setup()
---- Loaded player: Player1
-- TPlayerArray.setup(): Success

Player file: PlayerList
Minutes until Break: 1
# of Minutes to Break: 600
Minutes until Break: 15
Sacred Clay Hammer: False
Take Breaks: True
Switch Worlds (After Break): True
Logout if Mod is near: True


And it works fine?

Coh3n

2014-01-12 13:47:52

^ That was fixed in the latest update. :)

E: The list won't populate. You have to manually add the players you want to use. I wanted to have a TCheckBoxList so the user would just select the players they want to use, but Lape doesn't support a TCheckBoxList yet, so for now, you'll just have to manually add the players you want to use.

The Mayor

2014-01-25 16:56:56

Nice stuff. You might want to change

{$i srlplayerform.simba}

to

{$i srl-6\lib\misc\srlplayerform.simba}

in your test script as new users might not know how to fix that.

Coh3n

2014-01-25 21:02:50

From: The Mayor
Nice stuff. You might want to change

{$i srlplayerform.simba}

to

{$i srl-6\lib\misc\srlplayerform.simba}

in your test script as new users might not know how to fix that.
Ah yes, thank you. Fixed.

Nufineek

2014-02-26 12:12:48

I get this when I try to login a playerfile via Rafiki Player Form:

Exception in Script: Runtime error: "Access violation" at line 1173, column 7 in file "C:\Simba\Includes\SRL-6\lib\core\players.simba"


What am I doing wrong? Also, is there a way to change the location where Simba saves player files?

Coh3n

2014-02-26 12:58:19

From: Nufineek
I get this when I try to login a playerfile via Rafiki Player Form:
What do you mean you're trying to login via Rafiki? Rafiki is only used to enter and save player information. There's no logging in of any kind.


From: Nufineek

What am I doing wrong? Also, is there a way to change the location where Simba saves player files?
Not that I know of.

You're likely one of the < 1% of people who, for whatever reason, can't save a file in Simba/Includes @Olly; is working on a fix for this). Try running Simba as admin and see if that changes anything.

E: Also, this thread is for the SRL Player Form, not Rafiki. The SRL Player Form is for script-specific settings. Rafiki is for saving private information like passwords and pins.

Nufineek

2014-02-26 13:04:34

From: Coh3n
What do you mean you're trying to login via Rafiki? Rafiki is only used to enter and save player information. There's no logging in of any kind.


Not that I know of.

You're likely one of the < 1% of people who, for whatever reason, can't save a file in Simba/Includes @Olly; is working on a fix for this). Try running Simba as admin and see if that changes anything.


Oh, sorry I meant log in via Playerform using XML file generated by Rafiki. Running as admin did not help. It's also my 1st time setting up SRL player form so I could have done a mistake somewhere else.

Coh3n

2014-02-26 13:06:27

From: Nufineek
Oh, sorry I meant log in via Playerform using XML file generated by Rafiki. Running as admin did not help. It's also my 1st time setting up SRL player form so I could have done a mistake somewhere else.
Do you normally get an error running a script? Or did this only come up when you tried using the player form? If the latter, post your player file code as well as line 1173 of players.simba.

Nufineek

2014-02-26 14:17:33

From: Coh3n
Do you normally get an error running a script? Or did this only come up when you tried using the player form? If the latter, post your player file code as well as line 1173 of players.simba.


1173:  if (getText) then

Player XML file:
<army>

<player>

<diplayName></diplayName>

<loginName>New Player</loginName>

<nickName></nickName>

<password></password>

<bankPin></bankPin>

</player>

</army>

Coh3n

2014-02-26 14:32:26

I mean the code in your script that implements the SRL Player Form (the initPlayerForm and declarePlayers procedures).

Nufineek

2014-02-26 14:54:08

procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.playerNames, playerForm.playerFile); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first

for i := 0 to high(players) do
with players[i] do
begin
MIN_P_BK := strToInt(playerForm.players[i].settings[0]);
MAX_P_BK := strToInt(playerForm.players[i].settings[1]);
MIN_B_BK := strToInt(playerForm.players[i].settings[2]);
MAX_B_BK := strToInt(playerForm.players[i].settings[3]);
ENABLE_BREAKS := strToBool(playerForm.players[i].settings[4]);
WHAT_TO_DO := playerForm.players[i].settings[5];
WHICH_BANK := playerForm.players[i].settings[6];
randomType := strToInt(playerForm.players[i].settings[7]);
end;
end;

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Unf pots'; // the title of the SPF, usually the name of your script

editBoxLabels := ['MIN Time before break','MAX Time before break', 'MIN Break length', ' MAX Break length']; // edit boxes are created for each array element
editBoxDefaults := [ '30', '140', '3', '50']; // optional default values for each edit box; array length must equal editBoxLabel length
checkBoxLabels := ['Take Breaks']; // same as editBoxLabels but for check boxes
checkBoxDefaults := ['True'];

comboBoxLabels := ['What to do?','Location', 'randomType']; // same as editBoxLabels but for combo boxes (drop down boxes)
comboBoxDefaults := ['Pots','AL', '1'];

// this needs to be done for every element in the comboBoxLabels array
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Unfs', 'Cleans', 'Pots']; // all the options available for the first combo box
comboBoxItems[1] := ['GE', 'AL', 'CAM']; // all the options available for the first combo box
comboBoxItems[2] := ['1', '2', '3', '4']; // all the options available for the first combo box
end;
end;

Coh3n

2014-02-26 17:06:40

Hmm, nothing jumps out at me. Do you call initPlayerForm() before declarePlayers() in your mainloop? Try calling this after initPlayerForm():

for i := 0 to high(playerForm.players) do
writeln(playerForm.players[i].settings);

Nufineek

2014-02-26 17:37:44

From: Coh3n
Hmm, nothing jumps out at me. Do you call initPlayerForm() before declarePlayers() in your mainloop? Try calling this after initPlayerForm():

for i := 0 to high(playerForm.players) do
writeln(playerForm.players[i].settings);

Yeah, it writes what I fill in the form..
[20, 70, 3, 30, True, Pots, CAM, 2]

Coh3n

2014-02-26 18:06:28

Well, I've managed to reproduce the error. It happens when your "players" array has a length of 0. So, there's something bad going on when you call players.setup(). Can you make sure SRL debug is turned on, and post the debug text before the error? This will tell us exactly what's going on.

Nufineek

2014-02-26 18:40:41

From: Coh3n
Well, I've managed to reproduce the error. It happens when your "players" array has a length of 0. So, there's something bad going on when you call players.setup(). Can you make sure SRL debug is turned on, and post the debug text before the error? This will tell us exactly what's going on.


Seems it's something with the playername from the player form.
---- WARNING: Invalid player name: poiwqueqwr
-- TPlayerArray.setup(): Success
-- TPlayer.login()
---- TPlayer.loginToLobby()
Exception in Script: Runtime error: "Access violation" at line 1173, column 7

Coh3n

2014-02-26 19:51:18

The names are case-sensitive, so make sure they are exactly the same in the player form as in Rafiki.

Nufineek

2014-02-27 02:42:02

From: Coh3n
The names are case-sensitive, so make sure they are exactly the same in the player form as in Rafiki.


That was it. Thanks! Also, is there a way to change the location where playerform saves the setting.xml file?

Coh3n

2014-02-27 11:57:49

From: Nufineek
That was it. Thanks! Also, is there a way to change the location where playerform saves the setting.xml file?
Yes, just set playerForm.scriptSettingsPath in your initPlayerForm() procedure. :) The default is the script's path.

Sk1nyNerd

2014-03-02 22:11:15

i get this error when trying to run the test form. can this be used with OldSchool granted the codes done in Lape? :D

Exception in Script: Plugin(libtesseract32) has not been found

Coh3n

2014-03-03 00:15:49

From: Sk1nyNerd
i get this error when trying to run the test form. can this be used with OldSchool granted the codes done in Lape? :D

Exception in Script: Plugin(libtesseract32) has not been found
If SRL-OSR is written in PascalScript, then no, this won't work. Plus, this utilizes the Players array in SRL-6 which is different than the players array in SRL-OSR.

Bixby Sayz

2014-03-05 12:26:58

From: Coh3n
E: The list won't populate. You have to manually add the players you want to use. I wanted to have a TCheckBoxList so the user would just select the players they want to use, but Lape doesn't support a TCheckBoxList yet, so for now, you'll just have to manually add the players you want to use.


So…If I understand this:

First you have to populate the player file ahead of time using the Player Manager. Then when you select that player file in the player form it DOES NOTHING. You have to memorize the names of the players and add them manually one at a time. Am I missing something here?

Wow. Just Wow. Kinda defeats the point of trying to make it easier for the user by having a player form.

Ashaman88

2014-03-05 12:28:05

From: Bixby Sayz
So…If I understand this:

First you have to populate the player file ahead of time using the Player Manager. Then when you select that player file in the player form it DOES NOTHING. You have to memorize the names of the players and add them manually one at a time. Am I missing something here?

Wow. Just Wow. Kinda defeats the point of trying to make it easier for the user by having a player form.


It's just the nicknames of the players you have to input… why not just name them player1, player2, etc.

But yeah it would be nice if it auto populated them as well

Bixby Sayz

2014-03-05 12:49:22

For my purposes this is at least double the work of having the user simply fill out the players in DeclarePlayers.

For my script there are no additional settings beyond the username/password. All I want to do is:
1) Maintain list of players (with their login information).
2) Maintain which players are active (and it does not do this that I see)
3) (Optional) Maintain individual player stats between sessions.

Guess I'll skip the player form as a lost cause and simply have user manually fill out DeclarePlayers. It will actually be faster.

Coh3n

2014-03-05 19:04:33

From: Bixby Sayz
For my purposes this is at least double the work of having the user simply fill out the players in DeclarePlayers.

For my script there are no additional settings beyond the username/password. All I want to do is:
1) Maintain list of players (with their login information).
2) Maintain which players are active (and it does not do this that I see)
3) (Optional) Maintain individual player stats between sessions.

Guess I'll skip the player form as a lost cause and simply have user manually fill out DeclarePlayers. It will actually be faster.
You're completely missing the point of the whole system, which isn't surprising since you like to jump to your own conclusions and insult anything you don't understand. I'll explain the system the best I can, and if you still don't like it, fine, don't use it.

We have Rafiki to greatly increase user's security. Utilizing Rafiki requires users to only input their username and password once. They don't have to input their private information for every script they use. This is good for when people post scripts on the forum – they won't accidentally leave their password in the script because it was never there. Rafiki also has an encryption option, meaning if someone is using a shared computer, another person can't just open a Simba file and get usernames and passwords.

That is the main purpose for Rafiki.

And it is not double the work. It's not like the user has to fill out Rafiki and your script EVERY time they want to use your script. They fill out Rafiki once and only once, then they can easily setup EVERY OTHER SRL script they wish to use.

The reason for the SRL Player Form is to make setting up scripts easier for users (obviously), which you seem to disagree. Even in your case, when you don't have additional setup options outside username/password, using the SRL Player Form will likely be easier for users. Believe it or not, people that have never seen code before get confused, even in the simplest concepts. Weird, right?

Another neat thing, the SRL Player Form is completely optional. So here's a thought: instead of being childish and ripping apart something you don't like, suggest something that you think might make it better.

I'll address your 3 things above, which, by the way, are all done regardless if you use the player form or not.

1) Not exactly sure how to explain this one. If you go through this guide and use the form properly, you have access to the "players" array which is the exact same array that is set in the standard declarePlayers() procedure.
2) When a user adds a player to the SRL Player Form, it's automatically set to active. If you think the player list should be automatically filled, and then have and "Active" check box, feel free to suggest it. Maybe this would have gotten you somewhere.
3) Has nothing to do with the SRL Player Form. You're free to use the booleans, integers, extended, and strings variables built into the TPlayer type either way.

There, I'm done.

E: Another thing that made me laugh. You said people have to memorize player names. How many people have so many accounts that they don't know the names? And of those people, how many don't keep a list of the player names? I'm guessing almost 0. And even then, guess where they have a list of their players? RAFIKI.

Bixby Sayz

2014-03-06 19:04:58

Have to admit my eyes glazed over and I zoned out reading your fun filled rant. I assume it was enlightening.

As for a suggestion…Have been thinking about this a lot in my spare time. One simple change would make this whole process fairly painless. If the settings file exists have the player form load it (as it does now). If it does not exist then when the user selects a player file load all the players from the file (or prompt and give an option to). Far easier to delete the few players you don't want with a few button clicks than to manually type in the name of each and every player you want to use. Simple. And much more user friendly.

Coh3n

2014-03-08 22:57:32

From: Bixby Sayz
Have to admit my eyes glazed over and I zoned out reading your fun filled rant. I assume it was enlightening.

As for a suggestion…Have been thinking about this a lot in my spare time. One simple change would make this whole process fairly painless. If the settings file exists have the player form load it (as it does now). If it does not exist then when the user selects a player file load all the players from the file (or prompt and give an option to). Far easier to delete the few players you don't want with a few button clicks than to manually type in the name of each and every player you want to use. Simple. And much more user friendly.
Sounds like a good change. Feel free to open a suggestion here.

Coh3n

2014-09-29 21:09:22

Updated to include hints that have been added in Simba 1.1. :)

The Mayor

2014-10-04 02:44:01

From: Coh3n
Updated to include hints that have been added in Simba 1.1. :)


New form is nice :)

Coh3n

2014-10-04 23:39:04

From: The Mayor
New form is nice :)
That was all @Olly; :)

He added a lot of form features to Simba and built the current player form from my original codebase, I believe.

Ross

2014-11-26 13:16:39

From: The Mayor
New form is nice :)


From: Coh3n
That was all @Olly; :)

He added a lot of form features to Simba and built the current player form from my original codebase, I believe.



Getting this error when I run the test script in OP:

Error: "Willow" is not a valid boolean. at line 56
Execution failed.
The following bitmaps were not freed: [Minimap Mask]

akarigar

2014-11-26 16:17:45

From: Ross
Getting this error when I run the test script in OP:

Error: "Willow" is not a valid boolean. at line 56
Execution failed.
The following bitmaps were not freed: [Minimap Mask]


Yeah, for some reason the code thinks there are four booleans instead of three! Should probably be fixed like so.

// booleans
booleans[0] := strToBool(playerForm.players[i].settings[3]);
booleans[1] := strToBool(playerForm.players[i].settings[4]);
booleans[2] := strToBool(playerForm.players[i].settings[5]);

// strings
strings[0] := playerForm.players[i].settings[6];

Coh3n

2014-12-06 13:24:32

From: Ross
Getting this error when I run the test script in OP:

Error: "Willow" is not a valid boolean. at line 56
Execution failed.
The following bitmaps were not freed: [Minimap Mask]


From: akarigar
Yeah, for some reason the code thinks there are four booleans instead of three! Should probably be fixed like so.

// booleans
booleans[0] := strToBool(playerForm.players[i].settings[3]);
booleans[1] := strToBool(playerForm.players[i].settings[4]);
booleans[2] := strToBool(playerForm.players[i].settings[5]);

// strings
strings[0] := playerForm.players[i].settings[6];


Thank you both; I've updated the attachment.

Ross

2014-12-06 13:44:34

From: Coh3n
Thank you both; I've updated the attachment.


You're welcome :)

slushpuppy

2014-12-11 02:11:50

I just ran your test script, and it crashed simba without any warning whatsoever. Anything I can do to debug this?

akarigar

2014-12-16 02:03:08

From: slushpuppy
I just ran your test script, and it crashed simba without any warning whatsoever. Anything I can do to debug this?


Yeah looks like @Coh3n updated the tutorial but not the script. Just change line 58 to the following and it should work.
strings[0] := playerForm.players[i].settings[6];

slushpuppy

2014-12-16 08:43:51

From: akarigar
Yeah looks like @Coh3n updated the tutorial but not the script. Just change line 58 to the following and it should work.
strings[0] := playerForm.players[i].settings[6];


Still a catastrophic crash hmm..

Kevin

2014-12-16 08:48:57

From: slushpuppy
Still a catastrophic crash hmm..


At what point does it crash? Even before bringing up the form?

slushpuppy

2014-12-17 21:30:41

From: Kevin
At what point does it crash? Even before bringing up the form?


Yes. No errors logged to any of the srl_error files

Kevin

2014-12-17 21:44:43

From: slushpuppy
Yes. No errors logged to any of the srl_error files


Hmm… I just downloaded it and ran it fine. try force updating srl?

slushpuppy

2014-12-19 23:29:41

From: Kevin
Hmm… I just downloaded it and ran it fine. try force updating srl?


Done. No effect. It works fine for my windows 8 desktop, not on this tho.. what library dependencies are called using this playerform thing?

Kevin

2014-12-20 21:31:01

From: slushpuppy
Done. No effect. It works fine for my windows 8 desktop, not on this tho.. what library dependencies are called using this playerform thing?


None that I really know of besides whatever LAPE uses… @Olly; ?

Olly

2014-12-20 21:48:01

From: kevin
none that i really know of besides whatever lape uses… @olly; ?


lcl?

HKbotz

2014-12-28 09:17:39

From: Ross
Getting this error when I run the test script in OP:

Error: "Willow" is not a valid boolean. at line 56
Execution failed.
The following bitmaps were not freed: [Minimap Mask]


I had the same problem, even after using the updated script. I fixed it by changing the declarePlayers() so it looks like this:
for i := 0 to high(players) do
with players[i] do
begin
// convert the integers
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);

// booleans
booleans[0] := strToBool(playerForm.players[i].settings[4]); //changed all 3 bools to come after settings[3] since it is the combo box and not a check box
booleans[1] := strToBool(playerForm.players[i].settings[5]);
booleans[2] := strToBool(playerForm.players[i].settings[6]);

// strings
strings[0] := playerForm.players[i].settings[3]; //changed this to settings[3]

// any other data types you've decided to use
end;

I assume this fixes it because the player form reads the combo boxes into the settings before the check boxes, so if it isn't working for others, this was my solution.
Now everything works fine and it has all the correct info in debug.

giavanni6

2015-02-03 21:18:06

Thank you Coh3n for posting this guide! It's really helping newbie scripters like me get a handle on it.

jackieo500

2015-02-12 22:43:12

This is a fantastic, made adding this feature a breeze. However I noticed that if you don't set any options that the user can modify (basically leaving initPlayerForm and declarePlayers blank) it produces a weird form that is too small for you to click on anything and can't be resized.
Anyways, thanks a ton for this!

Myn

2015-03-25 12:33:32

Thank you so much. I finally figures out how to use this

Thomas

2015-04-16 11:01:09

I'm having troubles with adding a combobox for banking locations.
Does anyone have a working method? The box results in a string, but the bank.open(xxx) requires an integer?
Can I strtoint it? I doubt it since it isn't a number. I suppose i could equal each string to a number?

sadfib

2015-05-04 16:29:01

StrToInt();
or make the combo box return the name of the bank constants, ie BANK_CHEST_CW or w.e

GetHyper

2015-06-14 03:47:24

Just read whilst out but reads well and should be simple to follow, thank you.