Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Dirty Bob

Pages: [1]
1
Scripting Chat / What is the proper way to handle this
« on: May 17, 2020, 10:17:45 AM »
So I just recently started sending parameters through gosub and I'm trying to figure out what is considered the correct way or proper way to handle those parameters through multiple subs. Is it proper to send a parameter to a new sub using a parameter from the current sub you're in like:

Code: [Select]
gosub TimeAndSaveCheck #TIME %2
:or
gosub ScanForWorldSave %2

I feel like I even forget at times what variables I'm trying to call on when I get a few subs deep. At the same time it's localized and reusable with variation and easy to trace back if you need to. This is a larger example of what I'm doing in one script using some pseudo code

Code: [Select]
set %mainLoop TRUE
repeat
{
      gosub Step1 #TIME #JINDEX
      gosub Step2 #TIME #JINDEX
      gosub Step3 #TIME #JINDEX
}
until %mainLoop = FALSE

sub Step1
Do Work
gosub TimeAndSaveCheck %1 %2
return

sub Step2
Do Work
gosub TimeAndSaveCheck %1 %2
return

sub Step3
Do Work
gosub TimeAndSaveCheck #TIME %2
Do More Work
gosub ScanForWorldSave %2
return

sub TimeAndSaveCheck
if %1 > #TIME - 60
   return TRUE
gosub ScanForWorldSave %2
return FALSE

sub ScanForWorldSave
for %i %1 #JINDEX
{
    scanjournal %i
    if The_world_is_saving in #JOURNAL || The_world_will_save in #JOURNAL
    {
       wait 30s
       break
    }
}
return



2
New member introductions / An Introduction
« on: May 16, 2020, 09:21:49 PM »
Hello everyone. I've been playing UO on and off since '98. I can still remember making my way to the Brit cemetery on my first day to quickly die then make a new character thinking that was that. When I died a second time I figured I was missing something because I was running out of slots. Luckily I learned a bit more about UO over the years. I switched over to mostly free shards after about a year.

I started scripting with UO Auto Pilot. At some point, I think looking for an auto looter, I stumbled upon EUO. I had no idea how to use it at all. After quite awhile I was able to figure out what a variable was and that was what I needed to change to tweak the scripts for free shards. It was definitely my first introduction to programming. I had no idea how anything actually worked though. Over the years I would learn more about the workings of EUO. I started adding my own subs to scripts. Then eventually I would mangle together parts of scripts to make some pretty workable automated scripts. I started playing browser incremental games and started using JS to write some scripts to automate those. I started to realize I got more enjoyment out of the problem solving involved with scripting than playing the game. I would jump back and forth between UO and browser games spending a couple months a year scripting before I'd hit a wall and I just couldn't expand my abilities. I'd generally come back in a year or so and could progress a little further but never truly get it. 

Having some extra time recently I felt the scripting bug again. It's probably been a good 5 or 6 years since I played UO so I figured I was going to finally make myself a fully automated mining script from scratch. This time around it has all kind of clicked. I started out easy and started with a simple base that I could continue to expand on. After two weeks I can say it's pretty much finished, along with a good deal of other smaller scripts. I learned a lot along the way too. The documentation didn't look like a foreign language, it all made sense for the most part. I finally figured out where these %1, %2, etc variables were coming from in people's scripts. I guess I never grasped parameters being passed and using return to pass results, and definitely didn't understand how to access the parameters once in the sub. It really opens up the ability to reuse code with variations required by the individual functions that call it. It also makes me want to rewrite all of my scripts. It's made me reflect on a couple of languages I've tried to learn and the concepts I wasn't understanding. I think its time for me to actually follow all the way through with learning a language.

I stumbled upon here trying to find some information about certain functions in EUO. Apparently I had registered here years ago and never introduced myself and forgot about it. Reading through some of the forum it looks like I missed out on a nice community. I figured I'd introduce myself and see who still is out here for this old game. I may throw some stuff at you guys to see where I could improve. 

Anyways, I guess the moral of the story is after 22 years I finally started to comprehend automation I was doing in UO. In another 22 years who knows what I can achieve. A LJ script?

Pages: [1]