Jump to content
  • 0

item preview NPC


kalabasa

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

How to add if itemid is not found it will say itemid has failed

//============================================================
//= Preview Item Script
//===== By: ==================================================
//= iHeart
//===== Current Version: =====================================
//= 1.0
//===== Description: =========================================
//= A method to allow headgear sprites to be previewed without
//= being 'stolen'
//============================================================
 
guildhall,105,54,4	script	Dressing Coach	624,{
 
    //save current look for later
    set @bottomview, getlook(3);
    set @topview, getlook(4);
    set @midview, getlook(5);
 
    //doesn't actually execute until just before a 'close' statement, or when the char leaves the npc's control
addtimer 1000, "PreviewStuffGlobal::On_Leave";
 
INTRO:
 
    mes "[Dressing Coach]";
	mes "                ";
	mes "Welcome to the";
	mes "Headgear Preview NPC!";
	mes "                ";	
    mes "Please input an itemID you would like to preview";
 
    input @itemid;
 
    //modifies char's look based on item
    set @equip, getiteminfo(@itemid, 5);
    set @view, getiteminfo(@itemid, 11);
 
    if(@equip != -1 && @view > 0) {
            //note: yes...i'm using atcommand here cause for some reason 
            //      'setlook' has permanent effects...last time i checked at least
            if(@equip & 1)
atcommand "@changelook 3 " + @view;
            if(@equip & 256)
                atcommand "@changelook 1 " + @view;
            if(@equip & 512) 
atcommand "@changelook 2 " + @view;
    }
 
    next;
    mes "Would to like to preview something else?";
	next;
    if(select("Yes", "No") == 1) {
        goto INTRO;
    }
        
    //*preview wears off automatically here due to delayed timer*//
 
    close; }
 
-	script	PreviewStuffGlobal	,{
 
On_Leave:
    atcommand "@changelook 1 " + @topview;
    atcommand "@changelook 2 " + @midview;
    atcommand "@changelook 3 " + @bottomview;
    end;
}

 

Edited by kalabasa
wrong info
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

    input @itemid;
	if (getiteminfo(@itemid, ITEMINFO_ID) <= 0) {
		mes @itemid+" has failed!";
		next;
		goto INTRO;
	}
	

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

On 9/18/2021 at 11:16 PM, Emistry said:
    input @itemid;
	if (getiteminfo(@itemid, ITEMINFO_ID) <= 0) {
		mes @itemid+" has failed!";
		next;
		goto INTRO;
	}
	

 

havent check this for so long! Anyway thank it worked.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...