ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: jtw1984 on April 18, 2010, 12:45:44 PM

Title: Question about Scripting
Post by: jtw1984 on April 18, 2010, 12:45:44 PM
Alright, I'm finally going to make the plunge to start learning how to write scripts. I have a question about the coding though. Is the coding you learn from scripting a variation of any other coding? Or is it only good for Ultima Online?

Title: Re: Question about Scripting
Post by: TrailMyx on April 18, 2010, 12:49:14 PM
You better start with "Open"EUO or else Cheffe's head will explode!  hehe.  (kidding, I don't use OpenEUO; I care to not learn yet another language...)

Seriously, though.  EUO is sort of it's own syntax.  It's meant to be very simple and easy to start with.  There are similar constructs in EUO as you might find in classical interpreted and compiled languages.  So you might notice some similarity, but find no real help with any one.  So it's generally best to take your favorite script you use daily and take it apart to see how it works.
Title: Re: Question about Scripting
Post by: jtw1984 on April 18, 2010, 02:04:19 PM
Ah k thanks!
Title: Re: Question about Scripting
Post by: Superslayer on April 18, 2010, 03:38:11 PM
A nice way of learning is to use pseudo-code (real words to describe the objective).  I picked this up from Freddy at WinUo. Here's an example of a simple procedure to find an item in a container, and move it to another one.  It's not exact, but the idea's there:
Code: [Select]
; pseudo-code
look for container A
set the id
look for container B
set the id
find item A in container A
set the id
lift item A from container A
drop item A into container B

Now one-by-one, replace each pseudo-line command with the appropriate euo language command
Code: [Select]
finditem ABC G_5                                    ; find container A within 5 tiles of your character
set %ContainerA #findid                             ; sets the specific id of the container to a variable
ignoreitem %ContainerA                              ; ignores ContainerA so you can find ContainerB
finditem ABC G_5                                    ; find container B within 5 tiles of your character
set %ContainerB #findid                             ; sets the specific id of the container to a variable
ignoreitem reset                                    ; since we ignored ContainerA , we'll have to un-ignore it
finditem XYZ C_ , %ContainerA                       ; now we look for the item in ContainerA
set %Item #findid                                   ; sets the specific id of the item to a variable
exevent drag %Item                                  ; lift the item out of the container
exevent dropc %ContainerB                           ; drop the item into ContainerB

Again, this example won't exactly work because the 'finditem' types are not correct, no wait's and prob some other stuff.  But just take it easy, line by line and definitely ask questions !  :)
Title: Re: Question about Scripting
Post by: jtw1984 on April 18, 2010, 07:50:59 PM
I will def be asking questions. :D As few as possible though. I'll try to start with something small. Give me a few weeks or couple months though. Ya know...work and all. Thanks again.