ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: talkmill on September 15, 2008, 09:50:51 AM

Title: set #lobjectid
Post by: talkmill on September 15, 2008, 09:50:51 AM
Lol i seem to have stumbled upon yet another strange error (probably because i really don't have any clue about the inner workings of easyuo).

I have a sub which is suposed to open a bod, then click all the apropriate items in the backpack. Usually it works fine but sometimes it gets stuck and gets quite a weird behavior. In the code (to open the bod i have:

Code: [Select]
fillbod:
set #LOBJECTID !bod
event macro 17 0

This always seems to work the first time the bod is supposed to open. But if some errors are detected the code jumps to "fillbod:" again to restart. When that happens it doesn't manage to set the variable #LOBJECTID. I have checked by stepping thrue the code and saw that sometimes the line "set #LOBJECTID !bod" didn't set #LOBJECTID to the value in !bod (even though the value in !bod was set).

Has anyone got any idea what can make the set-command stop working sometimes?

Title: Re: set #lobjectid
Post by: TrailMyx on September 15, 2008, 09:58:57 AM
Are you sure you aren't accidentally changing the namespace?  You might have the correct namespace selected the first time, but this can change in another function/routine if you aren't careful.  Can you post or PM the full subroutine?
Title: Re: set #lobjectid
Post by: Xclio on September 15, 2008, 10:31:59 AM
It does sound like at some point in time your changing the namespace that is the most logical reason as to why this would be happening.
Title: Re: set #lobjectid
Post by: talkmill on September 15, 2008, 10:37:32 AM
Yeah, i thought so, have to check again. Otherwise i will post the code. It's quite alot of ugly hard to follow code though :P
Title: Re: set #lobjectid
Post by: TrailMyx on September 15, 2008, 10:41:50 AM
Yeah, i thought so, have to check again. Otherwise i will post the code. It's quite alot of ugly hard to follow code though :P

Put a "pause" at the beginning of that sub, and note the values of #NSNAME and #NSTYPE.  Then check it again when you get back to see if someone hijacked it.
Title: Re: set #lobjectid
Post by: talkmill on September 15, 2008, 10:59:15 AM
Thx for the quick help. Found two return in the middle of subs without namespace pop which probably caused it. Will try again to see if i get some hickups.

Now for an offtopic question: I am writing a script that uses another persons sub/script (craftinfo.txt by kal in ex). How do you go about to give proper thanks/acknowledgement when you have written a script that calls someone elses? Is it enough just to put the persons name in your header and a link, or should you ask the author for permission first?
Title: Re: set #lobjectid
Post by: 12TimesOver on September 15, 2008, 11:59:52 AM
I usually put a little something in after the header like:

Code: [Select]
;=======================================================
; Script Name: XIIxOveR's Lightning Lockpicking Trainer
; Author: XIIxOveR                                     
; Version: 1.0 Public                                   
; Shard OSI/FS: OSI                                     
; Revision Date: 14-May-2008                           
; Purpose: Train Lockpicking                           
;============================================================================
; Thanks to TM, Cerveza, and C2 for Gump, Wait, and Decimal Convert subs as
; well as great tutorials!
;============================================================================

XII
Title: Re: set #lobjectid
Post by: TrailMyx on September 15, 2008, 01:44:58 PM
Thx for the quick help. Found two return in the middle of subs without namespace pop which probably caused it. Will try again to see if i get some hickups.

Now for an offtopic question: I am writing a script that uses another persons sub/script (craftinfo.txt by kal in ex). How do you go about to give proper thanks/acknowledgement when you have written a script that calls someone elses? Is it enough just to put the persons name in your header and a link, or should you ask the author for permission first?

I've found several "mainstream" scripts that jump out of a sub without first setting the namespace back.  Hell, I've accidentally done it myself.  They are just hard bugs to track down.

Typically Kal allows his script snippets posted without issue, but do be sure to put credit in your script and you'll be fine. 

Problem comes when you are posting a complete, but tweaked script from someone else.  For that you always need to seek their approval.

Edit:  Don't type and drink at the same time; it leads to massive typos!  heh.
Title: Re: set #lobjectid
Post by: talkmill on September 15, 2008, 09:37:41 PM
True, the problem is I haven't found a way where kal in ex has posted this one, i've only seen it with other peoples scripts. Guess i will have to contact him and ask :)