Author Topic: RulesScript  (Read 3314 times)

0 Members and 2 Guests are viewing this topic.

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
RulesScript
« on: May 02, 2008, 08:49:44 am »
Script Name: RulesScript
Script Description: Small script that will display rules out of a txt file
Original Author(s): JFK and KeyDon(xplit, ofcourse)
Core Version: 2.6.3
Code<--click

This script was requested by dark here but it thought it would be useful to post it anyway. More info can be found in the code. Just one thing to add:
This script wont show !rules if a player types !commands. Most servers already have ARSSE running and it can be added there. Go to the ARSSE folder and then the script folder. There open OnPlayerSpeak.txt. There you will find:

Code: [Select]
if $MESSAGE = !commands
/say Available commands:
(... more /say's)
endif

Here you can add:
Code: [Select]
/say !rules - will show the rules
BEFORE endif. This should work, if you have OnPlayerSpeak activated on the server in ARSSE.
Come join: EliteCTF
Listen to: My Music

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: RulesScript
« Reply #1 on: May 02, 2008, 07:52:44 pm »
This script... Wait for it... Wait for it... Rules! :D

...

Well, it had to be done. You should all thank me for taking a terrible-joke-bullet for you.


Another quality script though, good work.

Offline Miszkol_

  • Major(1)
  • Posts: 30
  • The Piccolo Power xD
Re: RulesScript
« Reply #2 on: May 03, 2008, 03:45:23 am »
Nice script.
thx for this ^^
English is hard language, please forget my bad :P

Offline Bellamy

  • Major(1)
  • Posts: 42
Re: RulesScript
« Reply #3 on: May 04, 2008, 02:03:34 pm »
I downloaded this script, it looks very good, but I opened the file with the actual rules and I edited them to say what I wanted them to. Am I supposed to do this? Did I do something wrong? Because I started up my server and there was an error saying, "Error Rules Script -> <AppOnIdle> Out of Range". It said that over and over and never stopped. What is the reason for this?

EDIT: Nvm. I found out that I accedentaly put a space somewhere in the folder name which didn't allow the script to upload.
« Last Edit: May 04, 2008, 02:06:11 pm by Bellamy »

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: RulesScript
« Reply #4 on: May 05, 2008, 05:01:14 pm »
hi im trying to add a !commands part to the rules script under OnPlayerSpeak, here is the code

Code: [Select]
if (text = '!commands') then begin
    for i:=0 to (GetArrayLength(commands)-1) do Command('/say '+commands);
  end;
its telling me

Code: [Select]
RulesScript -> [Error] (106:33): Unknown identifier 'commands'
Script "rulesscript" disabled due to errors. Recompile to try again.

 i have already made a commands.txt file and put it in with the script

what am i missing?
« Last Edit: May 05, 2008, 05:03:14 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: RulesScript
« Reply #5 on: May 05, 2008, 08:50:22 pm »
You haven't defined 'commands', which you need to do at the top under 'var'. It should look like this.
Code: [Select]
var

i, autospit_time, antispam_time : integer;
Rules, commands : TstringArray;

It still wont work (type mismatch) because you need to put '' in the say part.
Code: [Select]
Command('/say ' + commands[i]);
That will get rid of the errors, but it still wont work (do anything). This is because you haven't actually loaded the commands.txt file. Add this right under the UpdateRules procedure,
Code: [Select]
Procedure UpdateCommands(ID: byte);
var index : integer;
begin
  commands := xsplit(readfile(commandsTXT), #13#10);
  index := (GetArrayLength(commands)-1)

  for i:=0 to index do
    if (commands[index-i] = '') then
      SetArrayLength(commands, index-i);
end;

This will give you an error, regarding commandsTXT. You need to define this up with RulesTXT, in const at the top.
Code: [Select]
const

RulesTXT = './scripts/RulesScript/Rules.txt';
Add "commandsTXT = './scripts/RulesScript/commands.txt';" under that.


Next, you want it to load the commands.txt file automaticly on startup - with ActivateServer.
Code: [Select]
procedure ActivateServer();
begin
  UpdateRules(255);
  autospit_time := AUTOSPIT_DEF;
end;
Add "UpdateCommands(255);' under 'UpdateRules(255);".

If you want to, you can also add a way to update the commands list without recompiling.
Code: [Select]
function OnCommand(ID: Byte; Text: string): boolean;
begin
  if (text = '/loadrules') then UpdateRules(ID);
  Result := false;
end;
Add "if (text = '/loadcommands') then UpdateCommands(ID);" under the loadrules part.


Finished script here, which hopefully should work. The commands part doesn't have the antispam stuff.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: RulesScript
« Reply #6 on: May 06, 2008, 01:32:38 am »
thankyou, all fixed now
for those who are interested, my server, when online is:
127.0.0.1:23073
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: RulesScript
« Reply #7 on: May 06, 2008, 05:15:09 am »
thankyou, all fixed now
for those who are interested, my server, when online is:
127.0.0.1:23073
thats your local ip... Only you can join 127.0.0.1
Google "what is my ip" and click on the first link and see what it says. Make sure you actually click on the link, not get the IP that the google site gives you from the list, senses that is actually google's ip.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: RulesScript
« Reply #8 on: May 07, 2008, 04:09:26 am »
err no my ip is 58.107.216.226 (according to Whatsmyip.com(bookmarked directly to the site in firefox)) not 127.0.0.1 i have checked cmd>ipconfig and 127.0.0.1 is not the isp address either so 127.0.0.1 must be the game address

how do i find out the game address? !info?
« Last Edit: May 07, 2008, 04:13:03 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline BombSki

  • Flagrunner
  • ****
  • Posts: 927
    • Climbing-soldiers.net
Re: RulesScript
« Reply #9 on: May 07, 2008, 06:44:37 am »
yea you type !info to get the address.... not

www.whatismyip.com is right.