Jump to content
  • 0

A error occuried when using Preview button


Question

Posted (edited)

//===== rAthena Script =======================================
//= Euphy's Quest Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.4b
//===== Compatible With: =====================================
//= rAthena SVN r15340+
//===== Description: =========================================
//= A dynamic quest shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
//= Item Preview script by ToastOfDoom.
//============================================================

zhakastia,103,37,1 script Quest Shop 998,{
function Add; function Chk; function Slot; function A_An;
if (.Shops$ == "") set .@i, select(.menu$);
else set .@i,1;
dispbottom "Select one item at a time.";
callshop "qshop"+.@i,1;
npcshopattach "qshop"+.@i;
end;
function Add {
if (getitemname(getarg(1)) == "null") {
 debugmes "Quest reward #"+getarg(1)+" invalid (skipped).";
 return;
}
for(set .@n,5; .@n<127; set .@n,.@n+2) {
 if (!getarg(.@n,0)) break;
 if (getitemname(getarg(.@n)) == "null") {
  debugmes "Quest requirement #"+getarg(.@n)+" invalid (skipped).";
  return;
 }
}
for(set .@i,2; .@i<.@n; set .@i,.@i+1)
 set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
return;
}
function Chk {
if (getarg(0) < getarg(1)) {
 set @qe0,1;
 return "^FF0000";
}
else return "^00FF00";
}
function Slot {
set .@s$,getitemname(getarg(0));
switch(.ShowSlot) {
 case 1: if (!getitemslots(getarg(0))) return .@s$;
 case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
 default: return .@s$;
}
}
function A_An {
setarray .@A$[0],"a","e","i","o","u";
set .@B$, "_"+getarg(0);
for(set .@i,0; .@i<5; set .@i,.@i+1)
 if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
return "a "+getarg(0);
}
OnBuyItem:
set .@q[0],@bought_nameid;
copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
if (!.@q[1]) {
 message strcharinfo(0),"An error has occurred.";
 end;
}
mes "[Quest Shop]";
mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
mes "Requirements:";
if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
 mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
next;
set @qe1, getiteminfo(.@q[0],5);
set @qe2, getiteminfo(.@q[0],11);
addtimer 1000, strnpcinfo(1)+"::OnEnd";
while(1) {
 switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512)) && @qe2 > 0 && !@qe6)?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
 case 1:
  if (@qe0) {
mes "[Quest Shop]";
mes "You're missing one or more quest requirements.";
close;
  }
  if (!checkweight(.@q[0],.@q[1])) {
mes "[Quest Shop]";
mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
close;
  }
  if (.@q[2]) set Zeny, Zeny-.@q[2];
  if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
  if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
delitem .@q[.@i],.@q[.@i+1];
  getitem .@q[0],.@q[1];
  if (.Announce) announce strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+"!",0;
  specialeffect2 699;
  close;
 case 2:
  set @qe3, getlook(LOOK_HEAD_BOTTOM);
  set @qe4, getlook(LOOK_HEAD_TOP);
  set @qe5, getlook(LOOK_HEAD_MID);
  set @qe6,1;
  if (@qe1&1) changelook LOOK_HEAD_BOTTOM, @qe2;
  if (@qe1&256) changelook LOOK_HEAD_TOP, @qe2;
  if (@qe1&512) changelook LOOK_HEAD_MID, @qe2;
  break;
 case 3:
  close;
 }
}
OnEnd:
if (@qe6) {
 changelook LOOK_HEAD_BOTTOM, @qe3;
 changelook LOOK_HEAD_TOP, @qe4;
 changelook LOOK_HEAD_MID, @qe5;
}
for(set .@i,0; .@i<7; set .@i,.@i+1)
 setd "@qe"+.@i,0;
end;
OnInit:
freeloop(1);
// --------------------- Config ---------------------
// Custom points, if needed: "<variable>","<name to display>"
setarray .Points$[0],"#CASHPOINTS","Cash Points";
set .Announce,0; // Announce quest completion? (1: yes / 0: no)
set .ShowSlot,0; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
set .DisplayID,0; // Show item IDs? (1: yes / 0: no)
set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
// Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
// Duplicate dummy data for any additional shops (bottom of script).
// If no categories, use the second line instead (remove //).
setarray .Shops$[1],"Headgears","Mid-Headgears","Lower Headgears";
// set .Shops$,"n/a";
// Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
//	 <required item ID>,<required item amount>{,...});
// Shop number corresponds with order above (default is 1).
// Note: Do NOT use a reward item more than once!
Add(1,22500,1,200000000,0,7063,700,7441,50,7216,50,7296,15,975,5,7510,5,2610,2,5174,1,2254,1,5159,1,4140,1,4305,1);
Add(1,22502,1,200000000,0,7166,666,7450,3,978,3,983,3,981,3,2274,1,2242,1,5035,1,5052,1,4133,1,4334,1);
Add(1,22503,1,200000000,0,7205,250,7063,250,914,100,7117,100,10007,15,4227,7,700,1,5045,1,5218,1,2250,1,1629,1,2651,1);
Add(1,22504,1,200000000,0,916,700,7095,300,7166,150,7263,100,7510,5,7451,2,2700,1,7754,1,5170,1);
Add(1,22505,1,200000000,0,12002,500,549,500,7166,300,521,150,721,100,729,100,7200,50,1060,50,10006,10,7289,10,5081,1,2273,1,1625,1,7754,1,2651,1);
Add(1,22508,1,200000000,0,949,700,7095,500,7563,500,7023,30,7109,25,7441,20,7300,5,7451,2,7754,1);
Add(1,22509,1,200000000,0,7205,400,7063,500,914,100,7117,100,2700,1,5045,1,1629,1,2651,1);
Add(1,22510,1,200000000,0,1060,500,7064,200,7440,40,7109,15,7510,10,2210,5,7023,10,2726,5,7211,2,5109,1,1175,1,7300,1);
Add(1,22513,1,200000000,0,7162,500,914,450,7754,1,2726,5,7211,2,5109,1,1175,1,7300,1);
Add(1,22506,1,200000000,0,7327,700,693,500,740,500,715,500,7448,350,728,150,722,50,725,50,1971,15,976,5,7293,2,5159,1,5034,1,5049,1,1481,1);
Add(2,22507,1,200000000,0,7446,700,991,700,7568,250,7562,3,7451,2,7290,6,10002,2,2651,2,7340,200);
Add(2,22600,1,200000000,0,7446,700,991,700,7562,2,7447,700,990,700,7451,2,7290,6,2201,1);
Add(2,22604,1,200000000,0,7340,700,12020,650,7563,375,7442,275,7266,175,4115,10,5069,1,7450,1,7436,1,7437,1,7438,1,7439,1);
Add(2,22605,1,200000000,0,7167,600,7319,400,4031,15,7352,150,4198,5,7010,40,10003,1,7566,1,7300,1);
Add(2,22601,1,200000000,0,1039,500,1038,500,7511,350,7315,350,7798,350,1008,100,2255,5,5044,5,7297,6,983,3,981,3,7566,2,2651,2);
Add(2,22602,1,200000000,0,949,600,7063,500,914,350,2210,10,10007,10,7292,6,982,6,2250,2,2214,2,2283,1,5074,1,2700,1);
Add(3,22501,1,200000000,0,938,700,1059,700,7139,333,7188,200,704,200,7108,15,7297,10,7292,10,7290,10,4058,3,2651,2);
Add(3,22511,1,200000000,0,7215,700,1038,500,1009,300,923,100,7020,20,7437,3,2614,2,7337,1,2276,1);
Add(3,22702,1,200000000,0,7063,500,7215,500,7161,300,1020,300,7205,250,727,200,923,200,983,5,7450,1,7619,1);
// --------------------------------------------------
freeloop(0);
set .menu$,"";
for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
 set .menu$, .menu$+.Shops$[.@i]+":";
 npcshopdelitem "qshop"+.@i,909;
}
end;
}
// -------- Dummy data (duplicate as needed) --------
- shop qshop1 -1,909:-1
- shop qshop2 -1,909:-1
- shop qshop3 -1,909:-1

here's the script everytime i click the preview it crash my client and my surroundings...how to remove preview or how to avoid crashing

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.

5 answers to this question

Recommended Posts

Posted

perhap it's ur custom item that make it error..make sure you installed your custom headgear correctly...

to remove preview..

remove these..

  set @qe3, getlook(LOOK_HEAD_BOTTOM);
  set @qe4, getlook(LOOK_HEAD_TOP);
  set @qe5, getlook(LOOK_HEAD_MID);
  set @qe6,1;
  if (@qe1&1) changelook LOOK_HEAD_BOTTOM, @qe2;
  if (@qe1&256) changelook LOOK_HEAD_TOP, @qe2;
  if (@qe1&512) changelook LOOK_HEAD_MID, @qe2;

and change

switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512)) && @qe2 > 0 && !@qe6)?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {

into this

switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000: ~ ^777777Cancel^000000")) {

Posted (edited)

//===== rAthena Script =======================================
//= Euphy's Quest Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.4b
//===== Compatible With: =====================================
//= rAthena SVN r15340+
//===== Description: =========================================
//= A dynamic quest shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
//= Item Preview script by ToastOfDoom.
//============================================================

zhakastia,103,37,1	script	Quest Shop	998,{
function Add; function Chk; function Slot; function A_An;

if (.Shops$ == "") set .@i, select(.menu$);
else set .@i,1;
dispbottom "Select one item at a time.";
callshop "qshop"+.@i,1;
npcshopattach "qshop"+.@i;
end;

function Add {
if (getitemname(getarg(1)) == "null") {
	debugmes "Quest reward #"+getarg(1)+" invalid (skipped).";
	return;
}
for(set .@n,5; .@n<127; set .@n,.@n+2) {
	if (!getarg(.@n,0)) break;
	if (getitemname(getarg(.@n)) == "null") {
		debugmes "Quest requirement #"+getarg(.@n)+" invalid (skipped).";
		return;
	}
}
for(set .@i,2; .@i<.@n; set .@i,.@i+1)
	set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
return;
}
function Chk {
if (getarg(0) < getarg(1)) {
	set @qe0,1;
	return "^FF0000";
}
else return "^00FF00";
}
function Slot {
set .@s$,getitemname(getarg(0));
switch(.ShowSlot) {
	case 1: if (!getitemslots(getarg(0))) return .@s$;
	case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
	default: return .@s$;
}
}
function A_An {
setarray .@A$[0],"a","e","i","o","u";
set .@B$, "_"+getarg(0);
for(set .@i,0; .@i<5; set .@i,.@i+1)
	if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
return "a "+getarg(0);
}

OnBuyItem:
set .@q[0],@bought_nameid;
copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
if (!.@q[1]) {
	message strcharinfo(0),"An error has occurred.";
	end;
}
mes "[Quest Shop]";
mes "Reward: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
mes "Requirements:";
if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
	mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
next;
set @qe1, getiteminfo(.@q[0],5);
set @qe2, getiteminfo(.@q[0],11);
addtimer 1000, strnpcinfo(1)+"::OnEnd";
while(1) {
	switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000: ~ ^777777Cancel^000000")) {

	case 1:
		if (@qe0) {
			mes "[Quest Shop]";
			mes "You're missing one or more quest requirements.";
			close;
		}
		if (!checkweight(.@q[0],.@q[1])) {
			mes "[Quest Shop]";
			mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
			close;
		}
		if (.@q[2]) set Zeny, Zeny-.@q[2];
		if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
		if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
			delitem .@q[.@i],.@q[.@i+1];
		getitem .@q[0],.@q[1];
		if (.Announce) announce strcharinfo(0)+" has created "+A_An(getitemname(.@q[0]))+"!",0;
		specialeffect2 699;
		close;
	case 2:
		break;
	case 3:
		close;
	}
}
OnEnd:
if (@qe6) {
	changelook LOOK_HEAD_BOTTOM, @qe3;
	changelook LOOK_HEAD_TOP, @qe4;
	changelook LOOK_HEAD_MID, @qe5;
}
for(set .@i,0; .@i<7; set .@i,.@i+1)
	setd "@qe"+.@i,0;
end;
OnInit:
freeloop(1);
// --------------------- Config ---------------------
// Custom points, if needed: "<variable>","<name to display>"
setarray .Points$[0],"#CASHPOINTS","Cash Points";

set .Announce,0;	// Announce quest completion? (1: yes / 0: no)
set .ShowSlot,0;	// Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
set .DisplayID,0;	// Show item IDs? (1: yes / 0: no)
set .ShowZeny,0;	// Show Zeny cost, if any? (1: yes / 0: no)

// Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
// Duplicate dummy data for any additional shops (bottom of script).
// If no categories, use the second line instead (remove //).

setarray .Shops$[1],"Headgears","Mid-Headgears","Lower Headgears";
// set .Shops$,"n/a";

// Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
//	 <required item ID>,<required item amount>{,...});
// Shop number corresponds with order above (default is 1).
// Note: Do NOT use a reward item more than once!

Add(1,22500,1,200000000,0,7063,700,7441,50,7216,50,7296,15,975,5,7510,5,2610,2,5174,1,2254,1,5159,1,4140,1,4305,1);
Add(1,22502,1,200000000,0,7166,666,7450,3,978,3,983,3,981,3,2274,1,2242,1,5035,1,5052,1,4133,1,4334,1);
Add(1,22503,1,200000000,0,7205,250,7063,250,914,100,7117,100,10007,15,4227,7,700,1,5045,1,5218,1,2250,1,1629,1,2651,1);
Add(1,22504,1,200000000,0,916,700,7095,300,7166,150,7263,100,7510,5,7451,2,2700,1,7754,1,5170,1);
Add(1,22505,1,200000000,0,12002,500,549,500,7166,300,521,150,721,100,729,100,7200,50,1060,50,10006,10,7289,10,5081,1,2273,1,1625,1,7754,1,2651,1);
Add(1,22508,1,200000000,0,949,700,7095,500,7563,500,7023,30,7109,25,7441,20,7300,5,7451,2,7754,1);
Add(1,22509,1,200000000,0,7205,400,7063,500,914,100,7117,100,2700,1,5045,1,1629,1,2651,1);
Add(1,22510,1,200000000,0,1060,500,7064,200,7440,40,7109,15,7510,10,2210,5,7023,10,2726,5,7211,2,5109,1,1175,1,7300,1);
Add(1,22513,1,200000000,0,7162,500,914,450,7754,1,2726,5,7211,2,5109,1,1175,1,7300,1);
Add(1,22506,1,200000000,0,7327,700,693,500,740,500,715,500,7448,350,728,150,722,50,725,50,1971,15,976,5,7293,2,5159,1,5034,1,5049,1,1481,1);

Add(2,22507,1,200000000,0,7446,700,991,700,7568,250,7562,3,7451,2,7290,6,10002,2,2651,2,7340,200);
Add(2,22600,1,200000000,0,7446,700,991,700,7562,2,7447,700,990,700,7451,2,7290,6,2201,1);
Add(2,22604,1,200000000,0,7340,700,12020,650,7563,375,7442,275,7266,175,4115,10,5069,1,7450,1,7436,1,7437,1,7438,1,7439,1);
Add(2,22605,1,200000000,0,7167,600,7319,400,4031,15,7352,150,4198,5,7010,40,10003,1,7566,1,7300,1);
Add(2,22601,1,200000000,0,1039,500,1038,500,7511,350,7315,350,7798,350,1008,100,2255,5,5044,5,7297,6,983,3,981,3,7566,2,2651,2);
Add(2,22602,1,200000000,0,949,600,7063,500,914,350,2210,10,10007,10,7292,6,982,6,2250,2,2214,2,2283,1,5074,1,2700,1);

Add(3,22501,1,200000000,0,938,700,1059,700,7139,333,7188,200,704,200,7108,15,7297,10,7292,10,7290,10,4058,3,2651,2);
Add(3,22511,1,200000000,0,7215,700,1038,500,1009,300,923,100,7020,20,7437,3,2614,2,7337,1,2276,1);
Add(3,22702,1,200000000,0,7063,500,7215,500,7161,300,1020,300,7205,250,727,200,923,200,983,5,7450,1,7619,1);

// --------------------------------------------------
freeloop(0);
set .menu$,"";
for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
	set .menu$, .menu$+.Shops$[.@i]+":";
	npcshopdelitem "qshop"+.@i,909;
}
end;
}

// -------- Dummy data (duplicate as needed) --------
-	shop	qshop1	-1,909:-1
-	shop	qshop2	-1,909:-1
-	shop	qshop3	-1,909:-1

correct?

Edited by Mootie
Posted

this part also not needed...

if (@qe6) {
 changelook LOOK_HEAD_BOTTOM, @qe3;
 changelook LOOK_HEAD_TOP, @qe4;
 changelook LOOK_HEAD_MID, @qe5;
}
for(set .@i,0; .@i<7; set .@i,.@i+1)
 setd "@qe"+.@i,0;

Posted

this part also not needed...

if (@qe6) {
 changelook LOOK_HEAD_BOTTOM, @qe3;
 changelook LOOK_HEAD_TOP, @qe4;
 changelook LOOK_HEAD_MID, @qe5;
}
for(set .@i,0; .@i<7; set .@i,.@i+1)
 setd "@qe"+.@i,0;

yeah figure it out oh and what is this error npc_event: event not found [ quest shop::onend]

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...