Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reading a Notecard

Ranos Brumer
Registered User
Join date: 17 May 2008
Posts: 9
01-03-2009 19:21
Ok here is my issue I'm trying to make a vendor script. What I want is to be able to put the pay price on the first line of a notecard. Is it possible to convert the dataserver string to an integer for the setpayprice integer and list?
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
01-03-2009 20:42
From: Ranos Brumer
Ok here is my issue I'm trying to make a vendor script. What I want is to be able to put the pay price on the first line of a notecard. Is it possible to convert the dataserver string to an integer for the setpayprice integer and list?


Yes. If the string holds a representation of an integer, you can just cast it.
Ranos Brumer
Registered User
Join date: 17 May 2008
Posts: 9
01-03-2009 20:58
how do you do that though.
Dytska Vieria
+/- .00004™
Join date: 13 Dec 2006
Posts: 768
01-03-2009 21:21
This should get you going...

CODE

dataserver(key QueryID, string Data)
{
string str;

if (QueryID == ConfigQuery)
{
if (Data != EOF)
{
str = llStringTrim(Data, STRING_TRIM);

list ldata = llParseString2List(str, ["="], [""]);
string configcmd = llToLower(llStringTrim(llList2String(ldata,0), STRING_TRIM));
string arg1 = llStringTrim(llList2String(ldata,1), STRING_TRIM);

if (configcmd == "vendorprice")
{
VendorPrice = (integer) arg1;
}
iLine++;
ConfigQuery = llGetNotecardLine(ConfigNotecard, iLine);
}
}
}


assuming there is a line in your notecard that has:

VendorPrice = 2000
_____________________
+/- 0.00004
Ranos Brumer
Registered User
Join date: 17 May 2008
Posts: 9
01-03-2009 22:52
Thank you.