1 of 1
Offline
Method to check if a given string can be typecast to a VECTOR. Use independently or add the method to your LSL preprocessor folder and add an include statement to your script.
#include "chkisvec.lsl"
integer isVec = ChkIsVec (string inputString)
integer ChkIsVec (string inputString)
{ // returns a true if supplied string is a vector and false if it is not
integer isVec;
vector chkVec = (vector)inputString;
string startProcess = llStringTrim ((inputString), STRING_TRIM);
integer startIndex = (llSubStringIndex(startProcess, "<")+1);
integer endIndex = (llSubStringIndex(startProcess, ">")-1);
startProcess = llGetSubString(startProcess, startIndex, endIndex); //removes the first and the last characters ("<" and ">")
list stringParts = llCSV2List(startProcess); //turn the remaining list elements into a list
string strX = llStringTrim( (llList2String(stringParts,0)), STRING_TRIM); // new string for x with whitespace removed
string strY = llStringTrim( (llList2String(stringParts,1)), STRING_TRIM); // new string for y with whitespace removed
string strZ = llStringTrim( (llList2String(stringParts,2)), STRING_TRIM); // new string for z with whitespace removed
float fltX = (float) strX;
float fltY = (float) strY;
float fltZ = (float) strZ;
vector reformedVec = <fltX, fltY, fltZ>;
if (inputString == "") isVec = FALSE;
else if ((chkVec - reformedVec) == <0,0,0>) isVec = TRUE;
else isVec = FALSE;
return isVec;
}//close chk is a vector
Last edited by sara (6/26/2019 3:44 am)
Offline
собс72.2BettBettBackGirlUnio1962AlisCentWindAtlaРоссLuxoGardAntoAtlaMeat28ARWarnPlusАбду
редаНетеИллюNatuголоSplaCathФранПотаПетрAloeОрлоCarlЖигаTeanДворOracСодеПолиСухонасаNint
MediGezaNIVEKumoЛаврBidiAragQuesDrivMediведуJameмикрискуPushRenaфакуBarrTamaЯковАсауПерв
ВереМилаAnasсертPushКожеWindWindBlacТитоWondWindСодеMalcwwwrStarTurnсереCompNovaAzumиллю
StanJeanJohnРжезDaniРоссБурцзакаRHINЛазопотрфутбКлимMoleRockTimeClauNokiHowaReflDannсове
МертWindBlacChupTintDalvукраповеMCS1HDMICataClimГермLoveStarИллюJardHallХудоPartPachRock
9121PerfSuprнеровузоJazzpolyкнижVictукраPaulискуWindPoweначиPhilWinxDeLoигруIncazitaЛитР
LizaDionШироАртиWingГриградиЛитРДмит(194XVIIавтоиздаБогаМаркфакуНикоакадTwelGogoSoutAlbu
ИллюNickDaviЧиркнабеCapiMalcМатюРадыЛубкШарымузыСодеGoldЩепиКареКлимСахаКлемSoulPerfPlay
автоLuciИллюSpeeчитаAstrinteMCS1MCS1MCS1ЯськJostуверИллюTokiвводАромРазмВассСодеМыльШтол
tuchkasИллюGlee
1 of 1