ID:159654
 
So I'm trying to parse through the text sent to the central server which I'm going to refer to as the "CEN". I'm wondering is this the right way to go when looking through the text to find the name and whatnot I used "C" because my key starts with "C".
world/Topic(T)
if(T)
var/text_mop = findtext("[T]","Message2",1)//goes through the text
if(copytext("[text_mop]",8,9) = "C")//checks if the name that comes after Message2 begins with "C"
for(var/mob/M in world)//loop
if(copytext("[M.name]", 0, 1) == "C")//Checks if the first letter ALSO begins with "C"
var/text_mop_2 = findtext("[T]","Message2",20)
text_mop_2 = copytext("[text_mop_2]",9,M.name.len)//Makes it so that the text mop is the length of their name so that it narrows it down to names that fit
if(text_mop_2 == "[M.name]")//if the text mop is the same length as their name and equals it...
var/text_mop_3 = findtext("[T]","[M.name]:",150)//parse through to find the message...
if(findtext("[text_mop_3]","/end")//Now "/end" is what I was going to use to signal the end of their\
message but how will I go back to find the actual msg? Must I make another arg in the name?


And yes...I do have a var for those who log in so that it tracks their ports.
Whats the overall goal here? I assume you should be using params instead of randomly searching through text, but that code is more confusing than helpful.
In response to Falacy
I am trying to parse through this format: "Message2[name]: [msg]/end" And I'm trying to find the msg using findtext but I don't know how.
In response to Choka
Choka wrote:
I am trying to parse through this format: "Message2[name]: [msg]/end" And I'm trying to find the msg using findtext but I don't know how.

world.Export("IP:Port?Name=[name];Message=[msg]")

world/Topic(T)
var/list/ParamList=params2list(T)
var/FoundMessage=ParamList["Message"]
In response to Falacy
Also, I can use Export to do the same for files right? Wait...I'm guessing yes...=)
In response to Choka
Choka wrote:
Also, I can use Export to do the same for files right? Wait...I'm guessing yes...=)

Uhhh, you can send files with Export... its not really the same thing, but okay.
In response to Falacy
One more thing..I was testing something and I was wondering, how would you go onto a webpage and search for a certain text?
Would this be it?:
mob/verb/Test()
var/Test[] = world.Export("http://www.byond.com/games/Choka/Test")
var/New = file2text(Test)
var/list/pwnsome = params2list(New)
if(findtext(pwnsome,"Choka"))
world<<"YOU OWN"

(The website is real)
In response to Choka
The DM Reference has an example. Downloading a webpage returns different results than just sending a message to a BYOND server; you get a list with a bunch of data.
In response to Kaioken
Kaioken wrote:
The DM Reference has an example. Downloading a webpage returns different results than just sending a message to a BYOND server; you get a list with a bunch of data.

Importing a text file from a website could yield similar results as Topic()
var/http[]=world.Export("http://www.website.com/Params.txt")
var/FileText=file2text(http["CONTENT"])
var/list/ParamList=params2list(FileText)

However if you're importing an actual web page like: http://www.byond.com/games/Choka/Test; You'd end up getting all the formatting code from the page, instead of just the text presented on it.
In response to Falacy
Falacy wrote:
Importing a text file from a website could yield similar results as Topic()

Theoretically, that's natural (in that manner), but not precisely; my statement is correct since by definition, a successful connection to a BYOND server always returns a text string, but a successful HTTP request always returns a list.
In response to Kaioken
Kaioken wrote:
Theoretically, that's natural (in that manner), but not precisely; my statement is correct since by definition, a successful connection to a BYOND server always returns a text string, but a successful HTTP request always returns a list.

I didn't say you were wrong. I was just saying that he could use world.Export() to achieve what he wanted.
In response to Falacy
Of course, but I had assumed that much has already been established.
In response to Falacy
I tried it and it didn't work, actually it does but it keeps displaying Message and Name as null.
In response to Kaioken
One more...small..tiny question, I've set up my central server and all. But how will I use the hub to find the port of it if it goes down? Or will I just need a permanent host?