Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008757opensim[REGION] Script Functionspublic2020-08-29 16:312020-09-02 08:43
ReporterAaack 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformLinuxOSUbuntuOS Version18.04 LTS
Product Version0.9.1.0 
Target VersionFixed in Version 
Summary0008757: llList2Vector and llList2Rotation fails to typecast the data (only on x-engine, 0.9.2)
DescriptionWhen pulling data from a list with llList2Vector it returns a ZERO_VECTOR and llList2Rotation returns a ZERO_ROTATION, even if the data is there.
Pulling the same data with llList2String gets the correct result.
Steps To ReproduceCreate a cube and put inside a notecard with this data:

<0.155928, 0.424868, 0.912199>
<1.000, 1.000, 1.000>
<0.000000, 0.000000, -0.707107, 0.707107>
<0.091502, 0.000000, -0.995805, 0.000000>

It's two vectors and two rotations, the name of the notecard is irrelevant.

Then add this script to the cube:

list test;
default
{
    state_entry()
    {
        test = [];
        string notecard_name = llGetInventoryName(INVENTORY_NOTECARD, 0);
        integer lines;
        for (lines = 0; lines <= osGetNumberOfNotecardLines(notecard_name); lines++)
        {
            test += [osGetNotecardLine(notecard_name, lines)];
        }
        llSay(0, (string)llList2Vector(test, 0));
        llSay(0, (string)llList2Vector(test, 1));
        llSay(0, (string)llList2Rot(test, 2));
        llSay(0, (string)llList2Rot(test, 3));
        llSay(0, (string)((vector)llList2String(test, 0)));
        llSay(0, (string)((vector)llList2String(test, 1)));
        llSay(0, (string)((rotation)llList2String(test, 2)));
        llSay(0, (string)((rotation)llList2String(test, 3)));
    }
}

expected results:

the cube says:

<0.155928, 0.424868, 0.912199>
<1.000000, 1.000000, 1.000000>
<0.000000, 0.000000, -0.707107, 0.707107>
<0.091502, 0.000000, -0.995805, 0.000000>
<0.155928, 0.424868, 0.912199>
<1.000000, 1.000000, 1.000000>
<0.000000, 0.000000, -0.707107, 0.707107>
<0.091502, 0.000000, -0.995805, 0.000000>

Actual results (only on x engine):

<0.000000, 0.000000, 0.000000>
<0.000000, 0.000000, 0.000000>
<0.000000, 0.000000, 0.000000, 1.000000>
<0.000000, 0.000000, 0.000000, 1.000000>
<0.155928, 0.424868, 0.912199>
<1.000000, 1.000000, 1.000000>
<0.000000, 0.000000, -0.707107, 0.707107>
<0.091502, 0.000000, -0.995805, 0.000000>
Additional InformationThe only way i've found to circumvent this bug is pull the data as string and then typecast it in real time:

(rotation)llList2String(list, index);
or
(vector)llList2String(list, index);
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineubODE
Script EngineXEngine
EnvironmentMono / Linux64
Mono Version6.x
ViewerFirestorm
Attached Files

- Relationships

-  Notes
(0036750)
djphil (reporter)
2020-08-29 19:04
edited on: 2020-08-29 19:04

This one return correct values.

default
{
    state_entry()
    {    
        string datas = osGetNotecard(llGetInventoryName(INVENTORY_NOTECARD, 0));
        list buffer = llParseString2List(datas, ["\n"], []);
        llSay(0, (string)llList2Vector(buffer, 0));
        llSay(0, (string)llList2Vector(buffer, 1));
        llSay(0, (string)llList2Rot(buffer, 2));
        llSay(0, (string)llList2Rot(buffer, 3));
        llSay(0, (string)((vector)llList2String(buffer, 0)));
        llSay(0, (string)((vector)llList2String(buffer, 1)));
        llSay(0, (string)((rotation)llList2String(buffer, 2)));
        llSay(0, (string)((rotation)llList2String(buffer, 3)));
    }
}


(0036751)
Aaack (reporter)
2020-08-30 07:19

Can confirm, it does work indeed.
It also works if you have the list hardcoded in the script, like:

test = [<0.155928, 0.424868, 0.912199>, <1.000, 1.000, 1.000>, <0.000000, 0.000000, -0.707107, 0.707107>, <0.091502, 0.000000, -0.995805, 0.000000>];

I wonder what's different between constructing the list line by line and parsing it with that llFunction.
(0036753)
tampa (reporter)
2020-08-30 12:44

Doing this with dataserver and base LL functions also yields the correct results, I think the list operation is the cause, do an llSay (string)list to verify the list itself is in correct format.
(0036754)
djphil (reporter)
2020-08-30 13:48

Also note that if you replace: test += [osGetNotecardLine(notecard_name, i)];
by: test += [(string)osGetNotecardLine(notecard_name, lines)];
it will also return the correct values.
(0036755)
Aaack (reporter)
2020-08-30 16:00
edited on: 2020-08-31 06:29

tampa: I tested that because I thought the same. originally I discovered this bug by using a long notecard full of vectors to plug them directly to llSetLinkPrimitiveParams.
llSay just showcase the vectors goes to ZERO_VECTOR instead of using the value pulled from the note.
Since they do appear by using (vector)llList2String I can assume safely the values do transfer correctly from the notecard to the list. They just fail when invoking those two functions.

Edit: I misread your update, yes I think the core of the issue may be that osGetNumberOfNotecardLines does not typecast at all and takes the values of a notecard as strings.
See my original example, you will pull the data, but you have to typecast it, i do llSay(0, (string)((vector)llList2String(test, 0))); the second typecast is just to make it compatible with llSay.

djphil: Awesome discovery! but I'll just use your one line method to get the notecard values you show at first, it looks way more efficient than a loop.

(0036773)
UbitUmarov (administrator)
2020-09-02 08:43

original should work now

- Issue History
Date Modified Username Field Change
2020-08-29 16:31 Aaack New Issue
2020-08-29 19:04 djphil Note Added: 0036750
2020-08-29 19:04 djphil Note Edited: 0036750 View Revisions
2020-08-30 07:19 Aaack Note Added: 0036751
2020-08-30 12:44 tampa Note Added: 0036753
2020-08-30 13:48 djphil Note Added: 0036754
2020-08-30 16:00 Aaack Note Added: 0036755
2020-08-31 06:29 Aaack Note Edited: 0036755 View Revisions
2020-09-02 08:43 UbitUmarov Note Added: 0036773


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker