SRL Archive - OSR Help

My Dice bot, help :)


demiraca

2013-03-23 13:30:58

Hello!
I am REALLY novice in this scripting thing, and i have read about 30 minutes of (http://villavu.com/forum/showthread.php?t=58935) that topic.
So yeah, my question is: How am i gonna "WriteLn" the number generated in the Debug box?

here is my script so far

program DiceBot;

procedure RandomFunction;
var
i: Integer;
begin
if (Random(101) <55) then
WriteLn('You have lost!')
else
WriteLn('You have won!');
end;
begin
ClearDebug;
RandomFunction;
end.


Note that the script looks more sorted in my simba but it doesnt show spaces here in forums.
When i press play i either get "you have won" or "you have lost"
and id like it to say like:
Wait(1000);
WriteLn('Rolling…');
WriteLn('You rolled "Number" and won!');
or WriteLn('You rolled a "Number" and lost!');

demiraca

2013-03-23 14:00:31

From: core
You can convert an integer to a string by using the IntToStr() function, and concatenating its output to whatever string you choose.


You can wrap your code in
tags to have it maintain the proper formatting.

Here's what your script would look like implemented to your specification:
program DiceBot;

procedure RandomFunction;
var
i: Integer;
begin
WriteLn('Rolling...');
Wait(1000);
i := Random(100);
if (i < 55) then
WriteLn('You rolled ' + IntToStr(i) + ' and won!')
else
WriteLn('You rolled a ' + IntToStr(i) + ' and lost!')
end;

begin
ClearDebug;
RandomFunction;
end.

Thanks i fixed it :)
Btw, do you know any topics that tell me about how to make a range guild script? :)
Id like to make one but idk if im gonna manage to since im crap at coding.

kyleinkman

2013-03-23 14:29:40

hey you can also check out my dice bot i have on here if you want anything to look at for reference

http://villavu.com/forum/showthread.php?t=94638