multiline string help
#1

hi, i'm newbie scripter but i ever programing vb.net before ,today i have problem about single statement line and multi statement line, in vb.net i will use & _ to seperate single statement to multiple statement and today when i scripting i have long statement that i want to seperate them but i don't know how to do plz help me

this is example code that i want to seperate

Code:
format(string,sizeof(string),"ItemData("idx[%d]Name[%s]Info[%s]Abt[%s]Price[%d]Weight[%d]Type[%d]Delay[%d]ModelID[%d]ModelColor[%d]ModelRotX[%f]ModelRotY[%f]ModelRotZ[%f]ModelZoom[%f],
				
					item_idx,
					Item[item_idx][Name],
					Item[item_idx][Info],
					Item[item_idx][Ability],
					Item[item_idx][Price],
					Item[item_idx][Weight],
					Item[item_idx][Type],
					Item[item_idx][Delay],
					Item[item_idx][ModelID],
					Item[item_idx][ModelColor],
					Item[item_idx][ModelRotX],
					Item[item_idx][ModelRotY],
					Item[item_idx][ModelRotZ],
					Item[item_idx][ModelZoom]);
this is code that i want to do

Code:
	format(string,sizeof(string),
					"ItemData("
					& _ "idx[%d]"
					& _ "Name[%s]"
					& _ "Info[%s]"
					& _ "Abt[%s]"
					& _ "Price[%d]"
					& _ "Weight[%d]
					& _ "Type[%d]
					& _ "Delay[%d]"
					& _ "ModelID[%d]"
					& _ "ModelColor[%d]"
					& _ "ModelRotX[%f]"
					& _ "ModelRotY[%f]"
					& _ "ModelRotZ[%f]"
					& _ "ModelZoom[%f]",
					item_idx,
					Item[item_idx][Name],
					Item[item_idx][Info],
					Item[item_idx][Ability],
					Item[item_idx][Price],
					Item[item_idx][Weight],
					Item[item_idx][Type],
					Item[item_idx][Delay],
					Item[item_idx][ModelID],
					Item[item_idx][ModelColor],
					Item[item_idx][ModelRotX],
					Item[item_idx][ModelRotY],
					Item[item_idx][ModelRotZ],
					Item[item_idx][ModelZoom]);
help me plz thx you
sorry for my bad english
Reply
#2

The only way to do it would be to have lots of formats to my best knowledge.

E.g.:

Code:
format(string,sizeof(string),"ItemData("idx[%d]", item_idx);
format(string,sizeof(string),"%sName[%s]", string, Item[item_idx][Name]);
format(string,sizeof(string),"%sInfo[%s]", string, Item[item_idx][Info]);
//and so on...
Reply
#3

It depends on where do you wanna show these information..
- If you wanna show it in a Dialog, use "\n" to make a new line.
- If you wanna show it as a textdraw, use "~n~".

Example:
pawn Code:
format(string,sizeof(string),"ItemData(idx[%d]\nName[%s]\nInfo[%s]\n ....", item_idx, Item[item_idx][Name], Item[item_idx][Info]);
ShowPlayerDialog(playerid, DIALOGNAME, DIALOG_STYLE_MSGBOX,"Title",string,"OK");
Reply
#4

Quote:
Originally Posted by Jonesy96
View Post
The only way to do it would be to have lots of formats to my best knowledge.

E.g.:

Code:
format(string,sizeof(string),"ItemData("idx[%d]", item_idx);
format(string,sizeof(string),"%sName[%s]", string, Item[item_idx][Name]);
format(string,sizeof(string),"%sInfo[%s]", string, Item[item_idx][Info]);
//and so on...
thx you Jonesy96 and Juvanii i think this is only way to do it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)