ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
weird stuff... (Sdk)
weird stuff... // SdkkahJul 22, 2001, 7:02pm
I'm currently working on a bot that searches an area for music objects
(objects with trigger + "sound" in the action field). But I have a weird problem: it reports an object as a music object (i.e. it had a trigger and "sound" in it's action field, but when it's supposed to post the actual action field, it returns a blank... here's the result of a query in my town: (22:47:20) Starting to query area... Found music object! (location: -2217.713N/S -2145.348W/E -.02a.) action field: (owner of object: KAH) Found music object! (location: -2217.713N/S -2145.348W/E -.02a.) action field: (owner of object: KAH) Found music object! (location: -2213.104N/S -2143.331W/E -.02a.) action field: create sound http://real-virtuality.com/midi/pa12.mid (owner of object: Neo15) and here is my code (triggered by AW_EVENT_CELL_OBJECT): If sdk.AwObjectAction Like "*create sound*" Then sdk.AwCitizenAttributesByNumber sdk.AwObjectOwner QueryConsole "Found music object! (location: " & Str((sdk.AwObjectZ / 1000)) & "N/S " & Str((sdk.AwObjectX / 1000)) & "W/E " & Str((sdk.AwObjectY / 1000)) & "a.) action field: " & sdk.AwObjectAction & " (owner of object: " & sdk.AwCitizenName & ")" ElseIf sdk.AwObjectAction Like "*activate sound*" Then sdk.AwCitizenAttributesByNumber sdk.AwObjectOwner QueryConsole "Found music object! (location: " & Str((sdk.AwObjectZ / 1000)) & "N/S " & Str((sdk.AwObjectX / 1000)) & "W/E " & Str((sdk.AwObjectY / 1000)) & "a.) action field: " & sdk.AwObjectAction & " (owner of object: " & sdk.AwCitizenName & ")" ElseIf sdk.AwObjectAction Like "*bump sound*" Then sdk.AwCitizenAttributesByNumber sdk.AwObjectOwner QueryConsole "Found music object! (location: " & Str((sdk.AwObjectZ / 1000)) & "N/S " & Str((sdk.AwObjectX / 1000)) & "W/E " & Str((sdk.AwObjectY / 1000)) & "a.) action field: " & sdk.AwObjectAction & " (owner of object: " & sdk.AwCitizenName & ")" ElseIf sdk.AwObjectAction Like "*adone sound*" Then sdk.AwCitizenAttributesByNumber sdk.AwObjectOwner QueryConsole "Found music object! (location: " & Str((sdk.AwObjectZ / 1000)) & "N/S " & Str((sdk.AwObjectX / 1000)) & "W/E " & Str((sdk.AwObjectY / 1000)) & "a.) action field: " & sdk.AwObjectAction & " (owner of object: " & sdk.AwCitizenName & ")" End If sorry, this looks a bit messy in the post, but if you know VB you'll understand how it's supposed to be... does anyone know why the sdk.AwObjectAction value suddently disapeares? KAH PS. don't ask me why I'm making such a bot :-)) ananasJul 22, 2001, 7:13pm
I don't know VB but :
1. you should have different messages for this test, to see which of your conditions fails 2. maybe you should combine your conditions with "or" later so you have a bunch of long lines less [View Quote] -- "_ | /\ \ / __/ /_ ananasJul 22, 2001, 7:24pm
hm, maybe I have an idea what it could be, an empty
action field could be "like" any string, that's how Clipper handled it, not sure about VB but maybe. That would mean already the first condition would always be true and you had to do something like if ( (sdk.AwObjectAction <> "") and ( (sdk.AwObjectAction Like "*create sound*") or (sdk.AwObjectAction Like "*activate sound*") or (sdk.AwObjectAction Like "*bump sound*") or (sdk.AwObjectAction Like "*adone sound*") ) ) then sdk.AwCitizenAttributesByNumber sdk.AwObjectOwner QueryConsole "Found music object! (location: " & Str((sdk.AwObjectZ / 1000)) & "N/S " & Str((sdk.AwObjectX / 1000)) & "W/E " & Str((sdk.AwObjectY / 1000)) & "a.) action field: " & sdk.AwObjectAction & " (owner of object: " & sdk.AwCitizenName & ")" End If -- "_ | /\ \ / __/ /_ kahJul 22, 2001, 8:16pm
like is for comparing stuff, roughly, it enables to use wildcards, so the
action can have anything before create sound (including nothing) and anything after it. anyways, I'm kinda comfused, because the objects it reported just didn't exist... and also, the sector it selects to query varies, and it only queries that sector, doesn't query the others... this seems weird, as I used the example code provided on the VB SDK help pages to query... KAH [View Quote] kahJul 22, 2001, 8:30pm
I think this has to do with VB's poor ability to handle great quantities of
data, as it also confuses citnums, etc KAH [View Quote] |