Jump to content
  • 0
Litro

Dynamic Menu Selection From SQL Data

Question

im writing this script and want to have dynamic menu like one writen by Annie Ruru on vendor control script, where the generated menu have previous and next page selection on it, can anyone help me to make it happen, tell you a tale i have staring into the script mentioned above for half hours and still not understand how the script work

 

here the script it not complete yet

prontera,150,150,1	script	Freelancer Manager	100,{	mes .@n$ = "[Manager]";	mes "Hi.. what I can do to help you?";	next;	switch(select("Submit Request","See Request List")) {		case 1:			mes .@n$;			mes "Input Item ID that you want to request";			next;			if (input(.@item_id,501,32768) || getitemname(.@item_id)=="" || getitemname(.@item_id)=="null") {				mes .@n$;				mes "Invalid input value or that item doesn't exist.";				close;			}			mes .@n$;			mes "Input how many "+.@item_id+" do you want to  request?";			next;			if (input(.@item_at,1,3000)) {				mes .@n$;				mes "Invalid input value or you are sick!!";				close;			}			mes .@n$;			mes "So you want to request "+.@item_at+"x "+getitemname(.@item_id)+", is that correct?";			next;			if (select("Yes, That's right.","Nope") == 2 ) {				mes .@n$;				mes "Okay, sure what ever "+(Sex?"Man.";"Woman.");				close;			}			mes .@n$;			mes "All right, lets talk about payment.";			mes "input item id that you will give as payment";			next;			if (input(.@pays_id,501,32768) || getitemname(.@pays_id)=="" || getitemname(.@pays_id)=="null") {				mes .@n$;				mes "Invalid input value or that item doesn't exist.";				close;			}			mes .@n$;			mes "Now please input amount of payment you will give";			next;			if (input(.@pays_at,1,30000)) {				mes .@n$;				mes "Invalid input value or you are too generous or too sick for sure.";				close;			}			mes .@n$;			mes "Okay, Let's rehash your fill";			mes "Request : "+.@item_at+"x "+getitemname(.@item_id);			mes "Payment : "+.@pays_at+"x "+getitemname(.@pays_id);			mes " ";			mes "Is everything above correct?";			next;			if (select("Yes, That's right.","Uh Oh I'm not sure") == 2 ) {				mes .@n$;				mes "Okay, sure what ever "+(Sex?"Man.";"Woman.");				close;			}			query_sql "INSERT INTO `job_board` VALUES ('"+getcharid(0)+"', '"+.@item_id+"', '"+.@item_at+"', '"+.@pays_id+"', '"+.@pays_at+"', unix_timestamp(now()))";			mes .@n$:			mes "All right, your request have been listed in request list, after 3 day your request will be erased from request list";			mes "and you will need to make new request for same item if you still need it, thanks for using my service";			close;		case 2:			.@data = query_sql("SELECT `char_id`,`item_id`,`item_at`,`pays_id`,`pays_at` FROM `job_board` ORDER BY `timestamp`", .@char_id, .@item_id, .@item_at, .@pays_id, .@pays_at);			// Credit to Annie Ruru - Taken From Vendor Control Script			.@maxpage = .@data / .slotperpage + ( .@data % .slotperpage > 0 ) -1;			while (true) {				.@menu$ = .@currentpage ? "Previous Page:" : ":";				.@pageindex = .@currentpage * .slotperpage;				for ( .@i = 0; .@i < .slotperpage && .@pageindex + .@i < .@data; .@i++ )					.@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^FF0000[UnAvailable]^000000:";				if ( .@currentpage != .@maxpage )					.@menu$ = .@menu$ + "Next Page";				.@pick = select( .@menu$ ) -1;				if ( !.@pick )					.@currentpage--;				else if ( .@pick == .slotperpage +1 )					.@currentpage++;				else					break;			}	}	OnInit:	.slotperpage = 10; // display how many slots per page (prevent making the menu too long)	query_sql "CREATE TABLE IF NOT EXISTS `job_board` ( `char_id` INT(11) NOT NULL DEFAULT '0', `item_id` INT(11) UNSIGNED NOT NULL DEFAULT '0', `item_at` INT(11) NOT NULL DEFAULT '0', `pays_id` INT(11) UNSIGNED NOT NULL DEFAULT '0', `pays_at` INT(11) NOT NULL DEFAULT '0', `timestamp` INT(11) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`job_id`)) ENGINE=MyISAM";	end;}

 

when menu generated it will seen like this

// First Page or Page One-1123x Red Pot1124x Red Pot1125x Red Pot1126x Red Pot1127x Red Potnext page// Page Two-previous page1123x Red Pot1124x Red Pot1125x Red Pot1126x Red Pot1127x Red Potnext page// Last Pageprevious page1123x Red Pot1124x Red Pot1125x Red Pot1126x Red Pot1127x Red Pot

when some one take the request, item requested will be mailed to the request maker and item requested  will be deleted from the request taker, and when player make request the item payment will be deleted from him and when request taker completed a request he will be given the payment

 

back to the tittle i asking for help to make the menu usable in game, and for the rest script if anyone want to help me to complete it a lot of thanks given and im grateful for it

 

if anyone want to complete overall script, i want to add admin menu for deleting request that not quit posible or crazy request if you know what i mean, to delete it from request and a request will be expire in 3 days there for i have make timestamp for the script to delete old entry request that have pased 3 days on the database

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

whoaa... even i have forgot about this script because when making thisscript  and can't resolve how to generate menu like what i want i got a bad mood and move on to other script but well now i can try to go for it again and thanks again maam

Edited by Litro

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.