Author Topic: How to use "Event property" correctly ??  (Read 6760 times)

0 Members and 1 Guest are viewing this topic.

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
How to use "Event property" correctly ??
« on: March 03, 2011, 09:17:11 AM »
0
Ok.. so the problem I'm running into is how to determine when the #property variable has actually updated (or not) AFTER performing the "event property" command.   If I'm running through the #findindex of a bunch of similar items I cannot simply check #property bc I don't know if it's actually Changed (or if it's still display the LAST item's info) if that makes sense.  If #property could be written too I would simply set it to X or something perform my "event property" but other than simply adding a hard wait after that command how do you guys go about it? I guess I'm looking for the equivalent of a  "Sub GumpWait "  basically.  If that's clear as mud I'll go dig up what I was using & post it etc.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #1 on: March 03, 2011, 09:35:37 AM »
0
Not sure what your doing... but normally the order of operation is:

find the item
event property #findid

then do your checks... like

if THIS in #property

It looks like you want to store all the info from the #property and compare it to the next item?
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #2 on: March 03, 2011, 09:49:06 AM »
0
Are you thinking that it executes the if BLAH in #property before it actually updates in the variables?  Interesting idea.  I have never noticed an issue there.  If you do what Cerveza said, the info is typically there in all of my experiences.

Scrripty

  • Guest
Re: How to use "Event property" correctly ??
« Reply #3 on: March 03, 2011, 12:15:35 PM »
0
He's running a property on items whose #property haven't updated from the server yet.  The problem is that you get nothing back when you do a property on these types of items.  There is no real gumpWait for this type of action.  The best thing to do period is avoid use of #property in these situations if you can.  There's ALWAYS a way to do it without #property.  And if there's not, you shouldn't really use it in your situation.  Post code.  Someone will be able to help you I'm sure.  The only real times I can think of when info wouldn't be updated is on the run.  You can run into this while trying to event property people/items while running through town right after logging in.  Or while pvping.  Most property information wont update while you're moving either.  You need to stop for a split second for it to update.  This was a lag fixing measure imo.  You don't feel the lag of downloading that info to your client if you're not moving.  If it does it on the run tho, you get lag spikes constantly while running around lots of people/buildings.

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #4 on: March 03, 2011, 01:31:22 PM »
0
ah.. i see

good example of why that happens.

I had a preventative measure in a couple of my scripts for this.   if i event prop an item and get a N/A or whatever i drag and drop and item back into my pack.  then i can read all the items in my pack again.

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #5 on: March 03, 2011, 02:09:48 PM »
0
Hmmmm......
Quote
He's running a property on items whose #property haven't updated from the server yet
I'm not clear on what you meant with that statement.  All I can come up with is Items that were recently spawned / crafted ? If that isn't the case are you trying to say that "event property" takes time before it actually updates the #property value?  (that's the way it works as far as I can tell but the time is sooo small I haven't tried measuring it.

Ok.. here's a quick example of something I've done a ton & I don't quite know why it doesn't work.  This is just a quick snippet I wrote to lockdown my plants etc.. but when doing ~1600 ish plants I inevitably have to run this x 2 to get them all though I'm not sure why it misses stuff.  The only thing I can think of atm is that if #property is still Displaying info from plant #1 when it should be displaying #property for plant #2.  Then effectively it would register plant #2 as locked down even though it isn't & skip the lockdown part.  Anway... just a timing issue with event property etc I think.   I didn't know about the moving aspect of it though which makes alot of sense (player scanners & such not functioning in certain cases)

Code: [Select]
Finditem QLI  ;--Should be a bowl of dirt unless I changed it for some reason lol.. can't check atm.
set %wait 1 ;---Increase this if you find yourself running the script more than 1x.  5/10/15 etc

For #findindex 1 #findcnt
  {
    set %plants_remaining #findcnt - #findindex
    event sysmessage Number Remaining %plants_remaining
    event property #findid
    wait %Wait
    If Locked notin #property
      {

        Msg I wish to lock this down$
        Target 2s
        set #ltargetid #findid
        set #ltargetkind 1
        event macro 22 0
        wait 15
       }
    }
Display OK Your Almost Done.  Run it again to make sure heh!
halt


Anyway.. hope that makes it more clear...  THX.

Scrripty

  • Guest
Re: How to use "Event property" correctly ??
« Reply #6 on: March 03, 2011, 03:11:31 PM »
0
Your problem isn't your event property.  You need to look at some better scripts for better examples of what to do.  The CLAw parses thousands of items without missing an event property, I've written scripts that craft and evaluate thousands of items with it.  Probly a good example of how to use event property in there.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #7 on: March 03, 2011, 04:25:38 PM »
0
Ok ive encountered this sort of thing many times before.   Only way to counter it is if you know something about the property string you should be recieving... Hopefully something at the end of the string that you always will see.   You then check for that existing in the property string and loop until you get it.


Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #8 on: March 03, 2011, 05:20:53 PM »
0
What you want to have in an event property sub is a check for a keyword found in the item you are looking for.


With just about every item in the game for instance you can just check for the word stone in the property to check if its updated.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #9 on: March 03, 2011, 06:17:51 PM »
0
The problem he's having is obvious in the code above guys. heh


I'm a bit rusty so Pray enlighten us...
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #10 on: March 03, 2011, 11:42:32 PM »
0
@ ManW / EN .....  

 Yea I'm aware of how to check that #property has actually  returned a value usually by looking for a specific word or checking that the string length is greater than 1 etc..  but This method doesn't work when your dealing with multiple items that are all exactly the same.  I've based all this on the assumption that "event property" Takes time to update the #property Value & that I have to account for that in my scripts but it just occurred to me that the needed waits could be built into the event... hmmmm   Anyway here's where I was having the prob.

Ex...

Item #1 #property Value =
A Vibrant Plain Prickly Pear Cactus Plant$Weight: 1 Stone$Locked Down$

Item #2 #property Value =
A Vibrant Plain Prickly Pear Cactus Plant$Weight: 1 Stone$Locked Down$

The Strings are exactly the same....  So after performing the event property on Item #2 how do you know when the #property Value is actually updated for Item #2 & is no longer showing Item #1 ??    Hmm...  lemme see if I can actually break event property intentionally...
Code: [Select]
START:
event property X ;---Invalid ID simply to clear #property to $
set #strres 0
str len #property
If #strres <> 1
  pause
event property #lliftedid
set #strres 0
str len #property
If #strres < 2
  pause
set %cnt %cnt + 1
event sysmessage Count = %cnt
goto START
OK...  Well It looks like I can't get event property to mess up in over 1000 events so It's gotta have all the necessary waits built into it.  I guess that answers my question heh.   This way when dealing with multiple identical items I can simply assume that #property is up to date after performing an event property.    I was thinking it would be like gumps where you can easily be displaying info from your LAST gump if you don't have the appropriate gumpwaits to insure your NEW gump has had time to open etc..    Anyway Thx .  Oh & Twinkle McNugget   I do realize the timing issue in the lockdown script is probably the wait 15 being too small to prevent a spam message, but the last time I'd tried it It worked in 1 try with that.   I usually don't bother posting here though unless I've already tried fairly hard to solve the problem myself though.

« Last Edit: March 04, 2011, 05:07:23 AM by _C2_ »

Scrripty

  • Guest
Re: How to use "Event property" correctly ??
« Reply #11 on: March 04, 2011, 12:26:32 AM »
0
It's absolutely the wait 15.  I was sure someone would catch it.  Funny.  You cannot try to do it too fast, or you'll skip some plants.  It's that simple.  Timing in EUO is EVERYTHING.  90 percent of all the stuff you do will require precise timing.  You didn't understand what manw said, and he was correct, you absolutely can wait for the property to update by checking it like the code below.  Probly not the best way, but it sure is A way.  I'm pretty sure that #property resets itself when you call it, so you're wrong in that it DOES work with lots of items with the exact same names.  There are waits built into an event property, hence why I said you should try to avoid using it as much as possible.  It's a slow function to call.  You're still not understanding it, but you'll get there.  The built in wait for event property is just that, a built in wait.  It does NOT wait for the property to completely update, it just waits to SEE if it will update, and if it doesn't, it moves on.  I've seen all of these situations happen at some point, most happen in different situations.  In yours, you can pretty much assume the #property info will update correctly and on time because you're standing still on screen with all your plants and all the info will already be updated to the client before you run your script.

Code: [Select]
event property #findid
set %timer #sysTime + 1000 ; This timer would need to be played with.
while plant notin #property || %timer > #sysTime
  wait 1
if %timer < #sysTime
  ; Re property the item?

If you put that inside your #findindex loop, it might help you understand better.  There's a few other ways to do it tho.  You do know to hit F6,F7,F8 to step line by line through a script correct? 

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #12 on: March 04, 2011, 10:46:40 AM »
0
Yup yup, Twinkle McNugget be right :)
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline AlphaTopic starter

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #13 on: March 04, 2011, 11:39:20 AM »
0
Twinkle McNugget Said:
Quote
I'm pretty sure that #property resets itself when you call it, so you're wrong in that it DOES work with lots of items with the exact same names.
Ok I'm not quite sure if I understand that fully.  Is what your saying that when I perform an 'event property' the #property Variable will be 1st Wiped clean & 2nd be updated with the #property of the item?  Since you were discussing additional error checking to make sure #property has updated I know the 2nd step can apparently Fail / Take too long but can the 1st step Fail?  (the wipe)  I'm still unsure of how to tell if #property has updated when you use "event property" on 2 identical items back to back.  The return strings in #property will be EXACTLY the same so after you perform the 2nd "event property" do you just assume it's correct?  can it fail etc? If I could clear the #property Value then it would be easy but without performing a "event property" on an invalid object etc #property will still contain the value from the last time etc.  Hope that makes it more clear.   I know simply adding hard waits can accomplish what I'm trying to do I just didn't know what the RIGHT way to do it was.

Ex...
Code: [Select]
event property %plant_1
;--#property = A Vibrant Plain Prickly Pear Cactus Plant$Weight: 1 Stone$Locked Down$
event property %plant_2
;--#property = A Vibrant Plain Prickly Pear Cactus Plant$Weight: 1 Stone$Locked Down$

Your code snippet makes perfect sense IF the act of 'calling' event property will clear the #property value 100% of the time. Then it's just a matter of checking to see if it's updated yet.  I just didn't realize that it potentially worked in that manner & that #property would still be displaying the value from the last object..     

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: How to use "Event property" correctly ??
« Reply #14 on: March 04, 2011, 12:36:59 PM »
0
What Twinkle McNugget was saying as I understand it is that yes... when you are standing in one place and not moving about the steps one and two happen without a hitch.  I have had to move an item in my pack once or twice because properties were not showing in the past and then it is fine from then on.

He was trying to make the point that as you run around or do other things that may produce lag, event property still updated just as fast but the UO client does not always show the items properties fast enough to be updated in an event property.  An example is in my intruder alert script.  If i am moving around a lot or running and come across a NPC, it triggers the alert because even thought the name is in my ignore list, the property was slow showing and easy uo read the item type before the property on it was updated in the UO client.  

In your case, Twinkle McNugget was saying that since you are standing in one place, there should be a lot less lag and things should update in a speed that is not an issue.  It should be clearing 100% of the time.  If you are watching the variables though, it looks the same.  It never goes blank and then reloads... it just switches to the next which is identical instantly.  no lag should equal 100% accuracy.

I do not think you got your answer that you were seeking though.  I am not sure if you can set an event property to N/A in between each scan to see evidence of the change when scanning each item.  In your case, you are standing still.  So in this case, Twinkle McNugget was saying that you are not moving and basically should not be experiencing a delayedrepresentation in event properties as described above.  Therefore, properties should be accurate.

Try:
event property #charid
wait 20
set #property N/A
halt

and see if the event property changes.

That may or may not be 100% what the gist was but that is what I got when skimming through the posts.  :)  Twinkle McNugget please jump in and further clarify if I unintentionally misrepresented any information.

I also gathered that your event message is possibly conflicting with your lock down message because there is not enough  between messages which could cause a possible timing hitch.  I have never tried mixing the two as exevent messages tweak me out, despite only being client side.  I just feel like GMs would see it somehow in the journal etc.  That is a diff story.
« Last Edit: March 04, 2011, 12:41:35 PM by _C2_ »

Tags: