ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: dxrom on November 06, 2011, 10:43:20 AM
-
Is it possible to store data to arrays with EUO? I've always been really shape at arrays in general (have a hard time understanding their logic in recording data). However it is something that I want to add to my LAME script...
Basically what I want to do is this: Advanced mana management for the sampire... basically, do two armor ignores, then a lightning strike, and repeat. If I remember correctly, the lightning strike will reset the double mana requirement for the armor ignores. The only way I can think of doing this, is recording the armor ignores to an array of some sort. Unless there is a variable that records the mana of the next armor ignore. Because there could be issues with such an array, given that it might not be able to calculate misses and would record misses at hits, thus lightning striking at the wrong time. Maybe a journal scanner could be used as a means of recording hits? "Your attack pierces their armor!" or whatever AI says when it hits.
-
You could do it with simple counters. Think of each swing as a "tick" and evaluate accordinginly:
tick tick tick tick tick tick
AI+ AI+ LS+ AI+ AI+ LS+
That's a fully successful series. You'd have 2 counters, one AI and one for LS (+ and - indicate success/failure)
Here's the thought process:
On tick #1, AI=0 and LS=0
On tick #2, AI=1 and LS=0
(if you were to fail, AI=0, LS=0 and it's as if you started over)
On tick #3, AI=2 and LS=0
(if you were to fail, AI=0, LS=0 and it's as if you started over)
On tick #4, if AI=2, then you LS, if not, you're back to AI
Think of each "tick" as a time to do an if (or case-style) statement. At each tick stage, decide whether to continue the pattern (due to success) or drop back to the beginning (or perhaps to a specific part in the sequence).
It's a little difficult to explain this on a fourm, but perhaps we could chat in vent or I can sketch up a diagram!
-
yes .. thiers a couple of tutorials on in it in that section if i remeber correctly
standard way is as follows
for %x 1 10
set %Array_ , %x %x
display ok %Array_1 - %Array_2 - %Array_3 - %Array_10
halt
-
You could do it with simple counters. Think of each swing as a "tick" and evaluate accordinginly:
tick tick tick tick tick tick
AI+ AI+ LS+ AI+ AI+ LS+
That's a fully successful series. You'd have 2 counters, one AI and one for LS (+ and - indicate success/failure)
Here's the thought process:
On tick #1, AI=0 and LS=0
On tick #2, AI=1 and LS=0
(if you were to fail, AI=0, LS=0 and it's as if you started over)
On tick #3, AI=2 and LS=0
(if you were to fail, AI=0, LS=0 and it's as if you started over)
On tick #4, if AI=2, then you LS, if not, you're back to AI
Think of each "tick" as a time to do an if (or case-style) statement. At each tick stage, decide whether to continue the pattern (due to success) or drop back to the beginning (or perhaps to a specific part in the sequence).
It's a little difficult to explain this on a fourm, but perhaps we could chat in vent or I can sketch up a diagram!
I think I understand what you're stating. I'm down to listening in vent also, or lookin up a diagram, pop me a PM for either.
-
yes .. thiers a couple of tutorials on in it in that section if i remeber correctly
standard way is as follows
for %x 1 10
set %Array_ , %x %x
display ok %Array_1 - %Array_2 - %Array_3 - %Array_10
halt
I'm gonna go dig around for these tutorials.
-
So I'm thinking for counters... I could implement something like
set %primCNT 0
repeat
if %primCNT = 2
gosub execLS
else
gosub execPRIM
until #CLICNT = 0
sub execLS
cmppix 1 f
{
event macro 15 149
wait 5
set %primCNT 0
}
return
sub execPRIM
cmppix 2 f
{
event macro 35 0
wait 5
set %primCNT + 1
}
return
However I'm still at a loss of determining a missed AI.
-
Hrm, I'd definitely like to see some input on how to determine a "miss"
Perhaps you look for the cmppix and also check if mana is lower?
-
Hrm, I'd definitely like to see some input on how to determine a "miss"
Perhaps you look for the cmppix and also check if mana is lower?
See I was thinking that exact same thing, however as a sampire you regain mana by your melee attacks. Thus if you AIed and regained mana, it would count as a miss, and you might get stuck in an endless loop where the counter continuously resets thinking that it is missing, however it would eventually right itself on two consecutive AI's that drained mana. However this I believe would prove highly inefficient.
-
I mean, there's the infamous journal scanning, but I don't think that's a good option (cmppix + no message = miss)
-
Yeah, I don't want to deal with journal scanning either... Too easy to abuse.
Damn these misses :(
-
yes .. thiers a couple of tutorials on in it in that section if i remeber correctly
standard way is as follows
for %x 1 10
set %Array_ , %x %x
display ok %Array_1 - %Array_2 - %Array_3 - %Array_10
halt
Well that is only a Pseudo Array for Easyuo. a Real array doesnt exist for EUO.
in oEUO you can insert functions in tables (like arrays).
Or does
set %Array_1 Pseudosub
Sub %Array_1
...
return
would work? who knows:)
-
yes .. thiers a couple of tutorials on in it in that section if i remeber correctly
standard way is as follows
for %x 1 10
set %Array_ , %x %x
display ok %Array_1 - %Array_2 - %Array_3 - %Array_10
halt
Ok, at first I didn't understand how this is an array but am I right to assume that what you are suggesting is that each individual variable represents an element in the array?
When I think of an array, at least a 2-dimensional array, I think of a spreadsheet.
X
-
As i said, its a pseudo Array. EUO dont allow regular arrays so you only could do
set %x1 Hello
set %x2 World
set %x3 !!!!
Display %x1 %x2 %x3
in lua it would be
Text = {"Hello","World","!!!"}
print( text[1].." "..text[2].." "..text[3] )
-
yes .. thiers a couple of tutorials on in it in that section if i remeber correctly
standard way is as follows
for %x 1 10
set %Array_ , %x %x
display ok %Array_1 - %Array_2 - %Array_3 - %Array_10
halt
Ok, at first I didn't understand how this is an array but am I right to assume that what you are suggesting is that each individual variable represents an element in the array?
When I think of an array, at least a 2-dimensional array, I think of a spreadsheet.
X
2 Dimenional Could be mirrored as well when you have a system for it liek
set %x1a Hello
set %x1z World
set %x2a !!!
etc..
you must arrange a own system how toi add more letters on your variable to manage a multiple dimensional array... But in end its only pseudo and that sucks :&
-
What I was looking into, was whether or not an array could store armor ignore hits and misses in order to intelligently handle mana consumption. Two successful armor ignores, then a lightning strike to reset the double mana multiplier. Instead of just having a script that did two armor ignores, then a lightning strike, despite whether or not anything hit or miss.
-
The best thing I can really think of doing... Would be to calculate the swing speed of a weapon, given character attributes (dex/stam) and weapon attributes (speed/ssi), in order to determine how often the character would swing, and to then attempt to "blindly" log hits and misses with a journal scan. IE: The script calculates that there should be a hit right now, so it watches for "your attack pierces" or whatever the msg is. if it doesn't see it, then it flags it as a miss..
Another way to do it would be to have it compare the pixel, when the ability is used, it checks the journal if != "attack msg" then it flags it as a miss... The only thing I dislike about this is that you're gonna get someone who knows about this weakness, who runs up on the sampire and yells "YOUR ATTACK PIERCES--" whatever the msg is, next thing you know you have a sampire that's gone full on retard. (Wouldn't be an issue with me though, I change the messages when utilizing journal scans)
-
As i said, its a pseudo Array. EUO dont allow regular arrays so you only could do
set %x1 Hello
set %x2 World
set %x3 !!!!
Display %x1 %x2 %x3
in lua it would be
Text = {"Hello","World","!!!"}
print( text[1].." "..text[2].." "..text[3] )
Well that's what I was getting at. EN's example is an array only because you could use that method LIKE you would use an array but managing it in EUO is a PITA.
I don't see the concept of an array helping or not helping in this problem; it's nothing more than storing a flag - success + success = #TRUE Else #FALSE. It's just figuring out how to tell if/when you had success.
How you store the variables in this case is arbitrary.
Wish I could come up with a creative way to figure out the solution to this though. Really, the question is "How do you determine if you've successfully performed an armor ignore when #MANA doesn't necessarily change?" right?
My brain is cramped this afternoon though and I'm annoyed with the Patriots and Freddy right now ;) so I'm sure I'm overlooking something...
X
-
Armor ignore is either the message or the pixel on the icon. Using mana will be an issue when you get vamped while waiting to perform an AI.
-
You can also journal scan for if you "gained in perfection", but that's only true if you honored your Target etc..
-
Yeah... I'm thinking the best way will be with message and pixel.
Something along the lines of this most likely.. However I could actually embed the mana management function into the execPrim subroutine itself also. But this just gives a general idea.
set %primCnt 0
set %aiMsg "blah"
repeat
gosub execPrim
if #sysmsg %aiMsg && cmppix 1 f && %primCnt < 2
{
set %primCnt + 1
}
if %primCnt = 2
{
gosub execLS
}
return
sub execLS
cmppix 1 f
{
event macro 15 149
set %primCnt 0
wait 5
}
return
sub execPrim
cmppix 2 f
{
event macro 35 0
wait 5
}
return
-
What I was looking into, was whether or not an array could store armor ignore hits and misses in order to intelligently handle mana consumption. Two successful armor ignores, then a lightning strike to reset the double mana multiplier. Instead of just having a script that did two armor ignores, then a lightning strike, despite whether or not anything hit or miss.
When hit then set %trigger x
when hit again set %trigger %trigger x
when % %Trigger = xx then do something...
when miss set Trigger o
then you can handle different things
when its xxx or xxo or xoo or ooo
When you want calculate different situations\spells make different triggert for each handler and then make a and combined if Case how you want to handle your situation..