2011年09月03日
ガチャガチャベンダーのエラーについて
こんにちは。
Drinkinsteins GAtcha Script - OSS Edition v1.0.1
というスクリプトを使わせてもらって、ガチャベンダーを作ってみたのですが、
トランス可・コピー不可の商品を入れた場合、商品がなくなっても
支払いが出来てしまいエラーとなります。
お客さんは商品が届かずお金だけ払ってしまう状態です。
ベンダーの中のオブジェクトがなくなった場合、フローティング
テキストで中身はないと表示できれば解決できると思うのですが。
どうすればよいでしょうか?よろしくお願いします。
Drinkinsteins GAtcha Script - OSS Edition v1.0.1
というスクリプトを使わせてもらって、ガチャベンダーを作ってみたのですが、
トランス可・コピー不可の商品を入れた場合、商品がなくなっても
支払いが出来てしまいエラーとなります。
お客さんは商品が届かずお金だけ払ってしまう状態です。
ベンダーの中のオブジェクトがなくなった場合、フローティング
テキストで中身はないと表示できれば解決できると思うのですが。
どうすればよいでしょうか?よろしくお願いします。
タグ :スクリプト
テクスチェンジのHUDについて
モール用のプリムカウンターを探しています
連続するアニメーションの処理
オブジェクトの上にフローティングテキストを出す。
チャットログの盗聴について
椅子に座った後で位置調整できるスクリプト
モール用のプリムカウンターを探しています
連続するアニメーションの処理
オブジェクトの上にフローティングテキストを出す。
チャットログの盗聴について
椅子に座った後で位置調整できるスクリプト
がないのでわからないのですが・・・
スクリプト貼ってもらえると対応しやすいです。
考え方としては
1. 最後にガチャをした後
money() の最後
2. 残りの商品の数が0だったら
if(llGetInventoryNumber==0){}
3. テキストで表示
llSetText("sold out",<1,1,1>,1);
支払い設定を解除する。
llSetPayPrice(PAY_HIDE,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);
ってかんじでいいとおもいます。
2. 残りの商品の数が0だったら
if(llGetInventoryNumber==0){}
↓
if(llGetInventoryNumber(INVENTORY_OBJECT )==0){}
changedでinvetoryの変化を確認する。
確認して景品の数が0ならフローティングテキストを表示。
景品の数が0じゃ無いならフローティングテキストを消す。
こんな感じのスクリプトを追加すれば可能です。
それでも支払い出来る事には変わらないので、商品が無くなった
ら支払えない様になっている方がいいでしょうね。例えば上記の物
でフローティングテキストを出す変わりに装置の覆いとなる様なプ
リムをrezして支払えない様にしちゃうとかね。
長いですが私にはちんぷんかんぷんです><;
利用規約らしきものも、一応全文貼り付けました
it様の助言通りに改造できるか一度試してみますね
よろしくお願いします。
/////////////////////////////////////
/////////////////////////////////////
integer price = 15; //SET PRICE HERE
/////////////////////////////////////
/////////////////////////////////////
//DrinkInstein Sorbet Open Source Gatcha Script. I am releasing this code under the Simplified BSD License.
//Copyright 2010 "Drinkinstein Sorbet" All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are
//permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
//THIS SOFTWARE IS PROVIDED BY "Drinkinstein Sorbet" ``AS IS'' AND ANY EXPRESS OR IMPLIED
//WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
//FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL "Drinkinstein Sorbet OR
//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
//SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
//ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
//ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//The views and conclusions contained in the software and documentation are those of the
//authors and should not be interpreted as representing official policies, either expressed
//or implied, of "Drinkinstein Sorbet".
key requestid;
string avatar;
default
{
state_entry()
{
llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}
touch_start(integer number)
{
string id = llDetectedKey(0);
string scriptname = llGetScriptName();
llPlaySound("0e20b5f9-1b06-843e-446c-49fee8827448", 1.0);
llInstantMessage(id, "Click pay to play the Gatcha!");
}
money(key id, integer amount)
{
list items;
list finalitems;
string name;
string stuff;
string returnitem;
integer num = llGetInventoryNumber(INVENTORY_ALL);
integer finalnum = num - 1;
string folder = llGetObjectName();
integer i;
integer min = 0;
string scriptname = llGetScriptName();
integer random = (integer)llFrand(finalnum);
if(random == num) {
random -= 1 ;
}
for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
items += name;
}
integer placeinlist = llListFindList(items, [scriptname]);
finalitems = llDeleteSubList(items, placeinlist, placeinlist);
returnitem = llList2String(finalitems, random);
integer finallen = llGetListLength( finalitems );
avatar = llKey2Name(id);
if(amount != price)
{
llInstantMessage(id, "You paid "+(string)amount+", which is the wrong amount, the price is: "+(string)price);
state default;
}
llPlaySound("0e20b5f9-1b06-843e-446c-49fee8827448", 1.0);
llSleep(2.0);
llPlaySound("81e91c22-6e1c-9cac-b6ab-7a7cab6a8a70", 1.0);
llSleep(1.5);
llInstantMessage(id, "You Purchased " + ": " + returnitem);
llGiveInventory(id, returnitem);
}
}
integer price = 15; //SET PRICE HERE
string f_text = "sold out"; // コメント
key requestid;
string avatar;
object_check(){
if(llGetInventoryNumber(INVENTORY_OBJECT) == 0){
llSetText(f_text,<1,1,1>,1);
llSetPayPrice(PAY_HIDE,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);
}else if(llGetInventoryNumber(INVENTORY_OBJECT) != 0){
llSetText("",<1,1,1>,0);
llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}
}
default
{
state_entry()
{
object_check();
}
touch_start(integer number)
{
string id = llDetectedKey(0);
string scriptname = llGetScriptName();
llPlaySound("0e20b5f9-1b06-843e-446c-49fee8827448", 1.0);
llInstantMessage(id, "Click pay to play the Gatcha!");
}
changed(integer change){
if(change & CHANGED_INVENTORY){
object_check();
}
}
money(key id, integer amount)
{
list items;
list finalitems;
string name;
string stuff;
string returnitem;
integer num = llGetInventoryNumber(INVENTORY_ALL);
integer finalnum = num - 1;
string folder = llGetObjectName();
integer i;
integer min = 0;
string scriptname = llGetScriptName();
integer random = (integer)llFrand(finalnum);
if(random == num) {
random -= 1 ;
}
for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
items += name;
}
integer placeinlist = llListFindList(items, [scriptname]);
finalitems = llDeleteSubList(items, placeinlist, placeinlist);
returnitem = llList2String(finalitems, random);
integer finallen = llGetListLength( finalitems );
avatar = llKey2Name(id);
if(amount != price)
{
llInstantMessage(id, "You paid "+(string)amount+", which is the wrong amount, the price is: "+(string)price);
state default;
}
llPlaySound("0e20b5f9-1b06-843e-446c-49fee8827448", 1.0);
llSleep(2.0);
llPlaySound("81e91c22-6e1c-9cac-b6ab-7a7cab6a8a70", 1.0);
llSleep(1.5);
llInstantMessage(id, "You Purchased " + ": " + returnitem);
llGiveInventory(id, returnitem);
}
}
謎ですね><
Unable to give inventory: 'No item named ''.'. (在庫を与えることができない:"アイテムが名前のない''.'.)
でないってことです@@;(最初スクリを入れたときだけ売り切れが出ます)
integer price = 15; //SET PRICE HERE
string f_text = "sold out"; // コメント
key requestid;
string avatar;
object_check(){
if(llGetInventoryNumber(INVENTORY_OBJECT) == 0){
llSetText(f_text,<1,1,1>,1);
llSetPayPrice(PAY_HIDE,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);
}else if(llGetInventoryNumber(INVENTORY_OBJECT) != 0){
llSetText("",<1,1,1>,0);
llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}
}
default
{
state_entry()
{
object_check();
}
touch_start(integer number)
{
string id = llDetectedKey(0);
string scriptname = llGetScriptName();
llPlaySound("0e20b5f9-1b06-843e-446c-49fee8827448", 1.0);
llInstantMessage(id, "Click pay to play the Gatcha!");
}
changed(integer change){
if(change & CHANGED_INVENTORY){
object_check();
}
}
money(key id, integer amount)
{
list items;
list finalitems;
string name;
string stuff;
string returnitem;
integer num = llGetInventoryNumber(INVENTORY_ALL);
integer finalnum = num - 1;
string folder = llGetObjectName();
integer i;
integer min = 0;
string scriptname = llGetScriptName();
integer random = (integer)llFrand(finalnum);
if(random == num) {
random -= 1 ;
}
for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
items += name;
}
integer placeinlist = llListFindList(items, [scriptname]);
finalitems = llDeleteSubList(items, placeinlist, placeinlist);
returnitem = llList2String(finalitems, random);
integer finallen = llGetListLength( finalitems );
avatar = llKey2Name(id);
if(amount != price)
{
llInstantMessage(id, "You paid "+(string)amount+", which is the wrong amount, the price is: "+(string)price);
state default;
}
llPlaySound("0e20b5f9-1b06-843e-446c-49fee8827448", 1.0);
llSleep(2.0);
llPlaySound("81e91c22-6e1c-9cac-b6ab-7a7cab6a8a70", 1.0);
llSleep(1.5);
llInstantMessage(id, "You Purchased " + ": " + returnitem);
llGiveInventory(id, returnitem);
object_check();
}
}
it様、Maaya Yohkoh様、ありがとうございました!
特にit様何度もスクリプト修正していただいて
ありがとうございます^^