• Log in or sign up for an account here: https://www.sythe.org/login

What is wrong with this script

Joined
Jul 30, 2009
Sythe Gold
0
Messages
25
Location
NZ
I have tried to write an encoding script but nothing happens but write a's in the debug box, note that this is a test script and is very repetitive:nuts: o_O

Code:
var abc1,abc2,abc3,abc4,abc5,abc6,abc7,abc8,abc9 :boolean;
var ran1,ran2,ran3,ran4,ran5,ran6,ran7,ran8,a1,b1,c1,d1,ii :integer;
var i0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26 :string;
var y1,y2,y3,y4,y5,y6,y7,y8,y9 :integer;
const
a = 1;
b = 2;
c = 3;
d = 4;
e = 5;
f = 6;
g = 7;
h = 8;
i = 9;
j = 10;
k = 11;
l = 12;
m = 13;
n = 14;
o = 15;
p = 16;
q = 17;
r = 18;
s = 19;
t = 20;
u = 21;
v = 22;
w = 23;
x = 24;
y = 25;
z = 26;

procedure Protocols;
begin
a1 := 21 + random(50);
b1 := 7 * random(8);
c1 := 100 - random(78);
d1 := 80 / random(5);
ran1 := a1 + 21 + random(40);
ran2 := d1 + b1 + 15;
ran3 := 50 - d1;
ran4 := 10 + random(42);
ran5 := random(7) * random(10);
ran6 := a1 + b1 + c1 + d1;
ran7 := 12 + random(8);
ran8 := ran2 - ran7 + random(20);
i0 := '-';
i1 := 'a';
i2 := 'b';
i3 := 'c';
i4 := 'd';
i5 := 'e';
i6 := 'f';
i7 := 'g';
i8 := 'h';
i9 := 'i';
i10 := 'j';
i11 := 'k';
i12 := 'l';
i13 := 'm';
i14 := 'n';
i15 := 'o';
i16 := 'p';
i17 := 'q';
i18 := 'r';
i19 := 's';
i20 := 't';
i21 := 'u';
i22 := 'v';
i23 := 'w';
i24 := 'x';
i25 := 'y';
i26 := 'z';
end;

procedure Report;
begin
y1 := 1;
y2 := 15;
y3 := 0;
y4 := 7;
y5 := 2;
y6 := 23;
y7 := 18;
abc1 := false;
abc2 := false;
abc3 := false;
abc4 := false;
abc5 := false;
abc6 := false;
abc7 := false;
abc8 := false;
abc9 := false;
writeln('Encoded word = ');
repeat
ii := y1;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc1 := true;
until(abc1 = true);
wait(2000);
repeat
ii := y2;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc2 := true;
until(abc2 = true);

repeat
ii := y3;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc3 := true;
until(abc3 = true);

repeat
ii := y4;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc4 := true;
until(abc4 = true);

repeat
ii := y5;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc5 := true;
until(abc5 = true);

repeat
ii := y6;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc6 := true;
until(abc6 = true);

repeat
ii := y7;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or

c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc7 := true;
until(abc7 = true);

repeat
ii := y8;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc8 := true;
until(abc8 = true);

repeat
ii := y9;
if ii = 0 then
writeln(i0);
if ii = a then
writeln(i1);
if ii = b then
writeln(i2);
if ii = c then
writeln(i3);
if ii = d then
writeln(i4);
if ii = e then
writeln(i5);
if ii = f then
writeln(i6);
if ii = g then
writeln(i7);
if ii = h then
writeln(i8);
if ii = i then
writeln(i9);
if ii = j then
writeln(i10);
if ii = k then
writeln(i11);
if ii = l then
writeln(i12);
if ii = m then
writeln(i13);
if ii = n then
writeln(i14);
if ii = o then
writeln(i15);
if ii = p then
writeln(i16);
if ii = q then
writeln(i17);
if ii = r then
writeln(i18);
if ii = s then
writeln(i19);
if ii = t then
writeln(i20);
if ii = u then
writeln(i21);
if ii = v then
writeln(i22);
if ii = w then
writeln(i23);
if ii = x then
writeln(i24);
if ii = y then
writeln(i25);
if ii = z then
writeln(i26);
if ii = a or
b or
c or
d or
e or
f or
g or
h or
i or
j or
k or
l or
m or
n or
o or
p or
q or
r or
s or
t or
u or
v or
w or
x or
y or
z or
0 then
abc9 := true;
until(abc9 = true);
end;

begin
Protocols;
Report;
end.
 
I didn't read through that, and I don't think many people will want to. In the future, make sure you comment your code and use proper indentation to make it easier to read for everyone else.

Also, you should be using loops and such instead of this style of code.
 
hi scarscripter101,

If u want to learn real coding, u should learn how to use loops, while's, arrays and much more stuff.
I don't really know what u would like to archive, but all the variables and such made it very hard to understand what the program actually does.
Maby can u explane to me what u are trying to make, and then i can see if i can help writing this encoder for u.

Thanks,

Eduard
 
If you're looking to change a string just a bit, so anyone who doesn't really care much, this should do it:

Code:
program New;
{.include srl/srl.scar}
Var
  EncodeArray : String;

Procedure Encode(Encoding : String);
Var
  I : Integer;
  Encoded, Key : String;
Begin
  For I := 1 to Length(Encoding) Do
  Begin
    if Pos(Lowercase(strget(encoding, i)), encodearray) <> 0 then
    begin
    If Lowercase(StrGet(Encoding, I)) = 'z' then
      Encoded := Encoded + 'a'
    else
    begin
      Key := StrGet(EncodeArray, (GetKeyCode(StrGet(Encoding, I)) + 1) - 64);
      Encoded := Encoded + Key;
    end;
    end else
      Encoded := Encoded + StrGet(encoding, i);
  End;
  WriteLn(Encoded);
End;

begin
  EncodeArray := 'abcdefghijklmnopqrstuvwxyz';
  Encode('hi.');
end.

What it does is it takes the string in Encode('') and moves each letter one forward. h becomes i, i becomes j, z becomes a, etc.

~Sandstorm
 
That is some hell of a mess in OP...
Posted these on freddy1990 SCAR forums, maybe someone here will find them helpful.

if you just want to switch out letters. like A becomes Z, B becomes F etc etc.
It will just change letters ignoring everything else, the Map must contain all 26 letters of the alphabet.
To create your own encode map, just type out all the letters of the alphabet in a random order.
Then write the decode map based on that... ie, if you map A->P your encode map will have P where A is in the alphabet, and your decode map will have A where P is in the alphabet etc etc.
Code:
program New;
Function SwitchLetters(S:String;Map:String):String;
Var
i:integer;
begin
 for i:= 1 to Length(S) do
  begin
  if (ord(lowercase(s[i])[1]) >= 97) and (ord(lowercase(s[i])[1]) <= 122) then  //is s[i] in a-z range?
  s[i]:=chr(ord(s[i])-ord(lowercase(s[i])[1])+ord(lowercase(Map[ord(lowercase(s[i])[1])-96])[1])); //Handles upper or lower case letters.
  end;
 Result := s;
end;
 
begin                                             //ABCDEFGHIJKLMNOPQRSTUVWXYZ
 WriteLn(SwitchLetters('ZOMG They is switched up!','POIUYTREWQASDFGHJKLMNBVCZX'));//Encode Map eg A->P
                                                  //ABCDEFGHIJKLMNOPQRSTUVWXYZ
 WriteLn(SwitchLetters('XGDR Meyz wl lvwmieyu nh!','KVXMHNOPCQRSTUBAJGLFDWIZEY'));//Decode Map eg P->A
end.

and this one codes each letter against each letter of the key.
so your encoded word might be 'XXXX' and it can decode that to 'HELLO', not just a simple remap.
Code:
program New;

Function XORString(S:String;Key:String):String;
Var
i,k:integer;
begin
 for i:= 1 to Length(S) do
  begin
   inc(k);
   s[i] := chr(ord(s[i]) XOR ord(Key[k]));
   if k=Length(Key) then k:=0;
  end;
 Result := s;
end;

begin
 WriteLn(XORString('Hello there','PASSWORD'));
 WriteLn(XORString(XORString('Hello there','PASSWORD'),'PASSWORD'));
 
 WriteLn(XORString(XORString('Hello there','PASSWORD'),'WRONG PASSWORD'));

 WriteLn(XORString('HELLO',chr(18)+chr(31)+chr(22)+chr(22)+chr(21))); //Outputs ZZZZZ
 WriteLn(XORString('ZZZZZ',chr(18)+chr(31)+chr(22)+chr(22)+chr(21))); //Outputs HELLO
end.
 
Runescape Gamblingrunescape gambling
Back
Top