SRL Archive - First Scripts

[RS3][SRL6] Bonsai Fighter


bonsai

2013-10-09 00:53:14

Released under public scripts.

Please use the thread there.

rj

2013-10-09 05:44:53

Grats on first release

Hoodz

2013-10-09 06:34:33

goodjob ;p

Solar

2013-10-09 07:16:52

Nice thread layout. Congrats on the release.
Maybe you could add the files as attachments so that you can see how many downloads each has had? Just a suggestion though. :p

bonsai

2013-10-09 07:53:04

From: Solar
Nice thread layout. Congrats on the release.
Maybe you could add the files as attachments so that you can see how many downloads each has had? Just a suggestion though. :p


I'm not sure what you mean. I used the attachment icon and dialog on the advanced post screen.

How are you suggesting it be done?

The Killer

2013-10-09 13:35:00

From: Solar
Nice thread layout. Congrats on the release.
Maybe you could add the files as attachments so that you can see how many downloads each has had? Just a suggestion though. :p

Hover over the link and it shows the amount of views (y)

Cage

2013-10-09 19:04:48

Gratz on release!

Rincewind

2013-10-09 23:41:47

Nice, scripts are starting to come back! gl on script, I won't use much due to already having maxed combat.

Aph0tix

2013-10-10 01:10:51

Congratulations on the release!

I want to start scripting for SRL 6 but it seems like there are no tutorials, do you have any advice on how I an start?

haiku

2013-10-10 02:55:46

Great release, this seems to have huge potential.

bonsai

2013-10-10 04:47:00

From: Rincewind
Nice, scripts are starting to come back! gl on script, I won't use much due to already having maxed combat.


I'm working on a watering script to soften clay, fill vials, etc. Maybe you could find use for that when it's presentable.

My little man is a new character so I'm limited in the work I can do.

I got him leveled up to 20s writing and debugging this script.

bonsai

2013-10-10 05:02:12

From: Aph0tix
I want to start scripting for SRL 6 but it seems like there are no tutorials, do you have any advice on how I an start?


I can appreciate what you're saying. What do you think would be most helpful? Detail posts on each of the main 'objects' like minimap, actionbar, tabBackpack?

I'm new to all of this (simba, smart, srl) and it's been a challenge to figure out how to get something going. Everyone's throwing around acronyms and you don't know what they mean or what to do with them! "Why didn't you walk with DTMs and use TPAs?"… if I only knew what the heck they were I could try lol. The documentation is sparse and often just reiterates the function definition. I found looking at the code was the best way of figuring out more of what the intent and usage would be.

You can use this script and Justin's fletcher as working examples to get a basic structure put together.

Anyone has my permission to rehash my code to get their script working; no need to contact me for specific permission. As is the norm, it would be nice to add a comment saying where you copied it from.

SRL6 Documentation

Justins fletcher

bonsai

2013-10-19 19:39:23

Updated with more npc support and some minor improvements.

Logs out when health gets too low
Turns towards NPCs when it can't find one
Combined into a single file for easy download/install.

bonsai

2013-10-25 09:25:56

Uploaded V1-1

This version works with the getMouseOverTextCount() functionality that Olly provided since the font changes broke mouseover text.

m3n4twork

2013-10-25 18:36:56

nice scripts,i try even im full in combat but got error,Exception in Script: Unknown declaration "getMouseOverTextCount" at line 414, column 24.

Foundry

2013-10-25 19:22:01

From: m3n4twork
nice scripts,i try even im full in combat but got error,Exception in Script: Unknown declaration "getMouseOverTextCount" at line 414, column 24.


Update SRL and that should fix it.

bonsai

2013-10-25 20:04:07

Glad to see someone trying it! Let me know how it works out for you.

From: HardcorBoter
Update SRL and that should fix it.


Yes, it need the newest version.

One note, SRL is having a login bug with the new update, so you need to log in manually.

Run something like this, then disable smart when it sticks on the lobby. Choose your own world, find a quiet place, then start the fighter script.

program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}

begin
ClearDebug();
SetupSRL();
players.setup(['TTnick'], 'characters');
currentPlayer := 0;
players[currentPlayer].login();
end.

Also, I made a small change not worth an update but it makes it kill a lot more NPCs. I was waiting 5 seconds to make sure it started the fight, doesn't seem like it needs that much.

Change line 455 from
t := getSystemTime() + 5000;
to
t := getSystemTime() + 2500;

Mar-TINO

2013-10-26 07:04:58

Hello, Thanks for this script. Have you got any idea on this error? -
Client is ready.
—- Setup SRL in 249ms.
– setupSRL(): True
– TPlayerArray.setup()
—- ERROR: Couldn't find army file(characters)
– TPlayerArray.setup(): false
– Freeing gametabs bitmaps..
– ****** bonsaiFighter: Script shutting down
—- Saving screenshot: bonsaiFighter.png

bonsai

2013-10-26 08:57:29

From: BottingFTW
—- ERROR: Couldn't find army file(characters)


You need to use the player manager to create a player file and add your character information.

I named my file in the player manager "characters".

If you didn't change the name on yours it would be named "default".

You can check SIMBADIR/includes/players to see the files that you made. They have .xml for the extension. You can open them in notepad to make sure the contents are what you expect.

Follow the info at the top about editing the script to set your own values. Change playername to your charcter name or alias. Change playerfile to the name of your players file.

playername = 'TTnick';       // change this to your username or nickname
playerfile = 'characters'; // change this to your playerfile name

Mar-TINO

2013-10-26 18:51:23

Thanks for that, sorry to be such a noob, I'm now getting the following error ->
Exception in Script: Runtime error: "Access violation" at line 1419, column 33
The following bitmaps were not freed: [SMART Debug Image]

I'm useless at scripting, about the only thing I will figure and help with is adding NPCs.

bonsai

2013-10-26 19:43:11

From: BottingFTW
Thanks for that, sorry to be such a noob, I'm now getting the following error ->
Exception in Script: Runtime error: "Access violation" at line 1419, column 33
The following bitmaps were not freed: [SMART Debug Image]

I'm useless at scripting, about the only thing I will figure and help with is adding NPCs.


No problem, man, we all start somewhere :)

I'm pretty new to this whole setup myself.

The line it's failing on is:
players[currentPlayer].world := desiredWorld;

This is telling me you don't have the user name/nickname set right or you don't have users in your player file.

Line 1265 should have your user name or nickname:

playername = 'TTnick';       // change this to your username or nickname

Mar-TINO

2013-10-27 10:25:37

I didn't even realise that I had to create a player through SRL. Done that now, any idea why it finds the colors of my created NPC but will not click attack? The mouse hovers over all the NPC's but just decides to rotate the camera?

bonsai

2013-10-27 11:04:22

From: BottingFTW
I didn't even realise that I had to create a player through SRL. Done that now, any idea why it finds the colors of my created NPC but will not click attack? The mouse hovers over all the NPC's but just decides to rotate the camera?


Yes, that's because of the problems reading mouseover text with the new update.

When it's hovering like that it should be printing mouseovertextcount numbers. Let's say it keeps printing 485. Add 485 to the last array in the npc record you added. For example, below if the corpse mage entry. The 483 below is the mouseover pixel count. The 108 is the count for plain old "Attack" since sometimes thats all they show instead of "attack corpse mage". Make sense?

['Corpse mage',52, 17.1,
5524794, 12, 3.6, 0.44,
['ttack', 'orpse'], 35, 35, 210,
'mrAAAAHichcqxCkAAAEXRJyllUharMiCDMjIpm29mNCkmROJL3JSVV2d4dW1JkyltGLHiwI4TF1qaDjMWbDgxoEdaNXJc7+GHkYIkU5wXz4/KWhbNF+PHuxuG4xEk',
120,
-1, [483, 108]]

Mar-TINO

2013-10-27 12:59:56

From: bonsai
Yes, that's because of the problems reading mouseover text with the new update.

When it's hovering like that it should be printing mouseovertextcount numbers. Let's say it keeps printing 485. Add 485 to the last array in the npc record you added. For example, below if the corpse mage entry. The 483 below is the mouseover pixel count. The 108 is the count for plain old "Attack" since sometimes thats all they show instead of "attack corpse mage". Make sense?

['Corpse mage',52, 17.1,
5524794, 12, 3.6, 0.44,
['ttack', 'orpse'], 35, 35, 210,
'mrAAAAHichcqxCkAAAEXRJyllUharMiCDMjIpm29mNCkmROJL3JSVV2d4dW1JkyltGLHiwI4TF1qaDjMWbDgxoEdaNXJc7+GHkYIkU5wXz4/KWhbNF+PHuxuG4xEk',
120,
-1, [483, 108]]


Fantastic, got it working now, going to let it run for 30 mins. One problem I've already noticed, is that it doesn't finishing killing an NPC before it clicks onto the next, is there a timer I'm not seeing somewhere?

bonsai

2013-10-27 14:32:54

Yes, in that last post the "120" on the second to last line is 120 seconds max for the fight. So if you're doing something that takes 4 minutes, bump it up.

Also, the messy string above it is the DTM to match when it's in a fight. You can see all the entries in _npcs[] are using the same one at the moment, but I guess it's possible its not matching for your NPC.

One other possibility is you're using range/magic and the NPC is moving off the main screen during the fight. That causes the DTM not to match and it thinks the fight is done.

If you want, post or pm the record you added and I'll sanity check it. If a nooby free-to-play character can try it I'll make sure it works ok.

Mar-TINO

2013-10-27 15:57:17

Its a P2P NPC, I am also using Melee. I'm currently trying to create a unique DTM for it, I'm guessing I should create it, while I am in combat?

bonsai

2013-10-27 17:38:31

Yes, the DTM isn't to match the NPC but to match something when it's in the fight.

'mrAAAAHichcqxCkAAAEXRJyllUharMiCDMjIpm29mNCkmROJL 3JSVV2d4dW1JkyltGLHiwI4TF1qaDjMWbDgxoEdaNXJc7+GHkY IkU5wXz4/KWhbNF+PHuxuG4xEk',

The one you see in all the other records will probably work fine. I made it to match the box outline on the right hand side of the window that pops up over the NPC. I've been using it on a bunch of different npcs and it's been good.

Mar-TINO

2013-10-27 18:11:20

Ahh okay, well I've been testing for a solid 2 hours, It constantly wants to attack other NPCs. Another thing I have noticed that may be a key in what is going wrong, it believes the monster has been killed and adds to the kill counter. I know this will be a solid script which is why I'm so keen on adding to it lol.

bonsai

2013-10-27 18:38:56

From: BottingFTW
Ahh okay, well I've been testing for a solid 2 hours, It constantly wants to attack other NPCs. Another thing I have noticed that may be a key in what is going wrong, it believes the monster has been killed and adds to the kill counter. I know this will be a solid script which is why I'm so keen on adding to it lol.


That's interesting because it means it found the DTM for a little while. If it doesn't match at all it won't bump the counter.

Here's where that generic DTM is matching, the box edges where the level is displayed.

[ATTACH=CONFIG]22350[/ATTACH]

Can you see if the box moves off the mainscreen area? That's the problem I'm having when using range/magic on a small screen. The DTM leaves the mainscreen and it thinks the fight is over.

I would use the colored bars above your character to see if in-fight but they can stay displayed for a long time after the fight so the kills per hour would go way down.

Mar-TINO

2013-10-27 20:07:50

From: bonsai
That's interesting because it means it found the DTM for a little while. If it doesn't match at all it won't bump the counter.

Here's where that generic DTM is matching, the box edges where the level is displayed.

[ATTACH=CONFIG]22350[/ATTACH]

Can you see if the box moves off the mainscreen area? That's the problem I'm having when using range/magic on a small screen. The DTM leaves the mainscreen and it thinks the fight is over.

I would use the colored bars above your character to see if in-fight but they can stay displayed for a long time after the fight so the kills per hour would go way down.


Yes it disappears pretty much straight away as the mouse moves off the NPC. I have tried creating a new DTM for that box too.

Foundry

2013-10-28 21:55:41

Thanks for making this! Helped me learn how to draw on smart (by reading your code) :).

bonsai

2013-10-29 03:00:27

From: HardcorBoter
Thanks for making this! Helped me learn how to draw on smart (by reading your code) :).


Oh boy you must have been ready to poke your eyes out before you found what you were looking for!

It's a mashup of 4 libraries I started to handle npcs/items/tasks/tracker. I pasted it all together to be able to hand out a single simba file. Mostly useless code that doesn't get executed.

I'm assuming you found this doc. The smartImage global isn't listed in the docs but all the functions are. And you need the "smartEnableDrawing := true;"

The debugTPA and debugATPA functions are super handy when trying to work out color finding and object location.

bonsai

2013-10-31 14:43:13

From: BottingFTW
Yes it disappears pretty much straight away as the mouse moves off the NPC. I have tried creating a new DTM for that box too.


In case anyone else bumps into it, this issue was resolved by checking the "Always show target information" box in the interface settings.

bonsai

2013-10-31 14:46:53

New version posted. Several fixes and improvements.

Added break timer and some NPCs from the stronghold of security.

Temporary workaround for mainscreen boundary issue.

Enjoy!