 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Sun Jan 07, 2007 9:36 pm
sending data with #url |
ok -- I decided I wanted to build a website, with php and MySql, that would hold some of the data from the mudd I play.
basic equipment stats is what I want to put in here, and with this data on the web, we can all (the members of my clan) enter equipment.
so I got the site setup, and am still working on the php part, but I need some help with a trigger.
So I have a group of triggers setup that put all the info I need into a variable (array) when I identify something--
so my #url command looks like this
#url www.mysite.com/mudd/add.php?name=@stuff.Name&type=@stuff.type&is=@stuff.Is
the problem is, cmud (and zmud) are interpeting the & as a variable declaration. -- any way to escape it, so it's seen as part of the url ?
I'd really like to be able to use POST data, instead of GET, but I can't come up with a way to do that... I'd be happy if someone knows a way tho! |
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Jan 07, 2007 9:42 pm |
Put quotes around it
#url {"www.mysite.com/mudd/add.php?name=@stuff.Name&type=@stuff.type&is=@stuff.Is"} |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Sun Jan 07, 2007 11:07 pm |
ahhh -- here it is---
#url {"www.mysite.com/mudd/add.php?name="@stuff.Name"&type="@stuff.type"&is="@stuff.Is"}
BTW :: -- if anyone knows a way to do this through POST, instead of GET, I'd love to know about it.
thanks |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jan 07, 2007 11:23 pm |
I don't think it's possible since the #URL command just opens a link. Perhaps COM could do it?
That's a great idea as it is, even so. |
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Sun Jan 07, 2007 11:25 pm |
that's what I'm thinking, but I don't know enough about com, or how to make it do it.
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Jan 08, 2007 7:20 am |
If your just wanting to stick stuff in/pull stuff out of a database you could use ADO and bypass the need for the php/URL layer. Of course this will only work if your MySql database allows remote connections
|
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Mon Jan 08, 2007 12:50 pm |
And it don't
besides, there is a little more to it than that. |
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Mon Jan 08, 2007 7:22 pm |
ok -- new problem, hope you don't mind me using the same thread....
I searched for about 20 mins on it, but can't find anything revelant.
this one has boggled me for a while now...
<65h(65H) 118v(118V)> look sphere
A sphere of pure crystal with a hint of blue color throughout. It is warm to
the touch and covered with odd runes depicting an ancient tale.
<65h(65H) 118v(118V)>
how can I catch the X lines returned from the look object command in the description and add it to a variable ?
also -- not all descriptions are 2 lines, some may be as much as 6, some may only be one.
Any thoughts ? |
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon Jan 08, 2007 8:27 pm |
Read up on #COND
Lets you match a 2nd (and 3rd, 4th...) trigger on the condition that the first one has fired.
So as long as you know the first line you could match ^(*)$ to grab anything following it, and you'd not then get huge speed problems because the ^(*)$ wouldn't be firing all the time, only after line 1. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jan 08, 2007 9:10 pm |
How about:
#alias look {#var LookCapture "";#var Item %proper(%1);~look %-1;#t+ LookCapture;#t+ LookDeactivate}
#trig "LookCapture" {^(*)$} {#additem LookCapture %1}
#trig "LookDeactivate" {PROMPT HERE} {#t- LookCapture;#t- LookDeactivate;#var @{item}Desc %replace(@LookCapture,"|"," ")}
You could also replace the bars with %cr if you want to retain multiple lines. |
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Mon Jan 08, 2007 11:58 pm |
That's what I was after, I knew I was going to have to have a class kick on at the alias, and I knew how to turn it off, what I couldn't figure out was how to add each line to the variable...
thanks! |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jan 09, 2007 1:34 am |
One addition: you might want to change the alias to:
#alias {#if (%numparam()) {#var LookCapture "";#var Item %proper(%1);~look %-1;#t+ LookCapture;#t+ LookDeactivate} {~look}}
because if you don't pass a parameter, you won't get a description of an item which could muck things up a bit. |
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Sun Feb 04, 2007 9:18 pm |
Humm -- I'm just getting around to using this.
While I'm sure it works fine in cmud, %-1 seems to freak zmud out.
I don't need to add the conditional, as I have a seperate alias setup for when I want to capture the description.
and using %1 means my variable only gets the first first word of every line.
so this
A massive bag made of thick leather, the outer layer has been ripped and torn
to shreds, obscuring the silvery runes that once covered it. Bits and pieces
of them can be seen, but never enough to be read. Whatever was holding on to
this bag probably liked the bag but not the runes.
shows up as this in my variable
A to of this
here is what I have --
#ALIAS loocap {#var LookCapture "";#var Item %proper( %1);~look %1;#T+ LookCaptureOn;#T+ LookDeactivateOn}
#TRIGGER "LookCatpureOn" {^(*)$} {#additem LookCapture %1}
#TRIGGER "LookDeactivateOn" {<%1h} {#T- LookCaptureOn;#T- LookDeactivateOn;#var @{item}Desc %replace( @LookCapture, "|", " ")}
I had to change the class names, cause having a class and a var with the same name was causing problems.
I'm still not comfotable using cmud doubleplaying, stuff keeps crashing (and I keep dying)
right now, I get the first word of every line in the
If I change the {#additem LookCapture %1} to {#additem LookCapture %-1} I get nothing in the varialbes.
any thoughts ? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Feb 04, 2007 11:50 pm |
This code won't work in zMUD, I wrote it for CMUD :)
In zMUD, it expands variables BEFORE it runs the commands. So in CMUD the %1 in the LookCapture trigger will always be interpreted as the the second argument and will always get put in the right place.
In zMUD, it gets expanded before the command is run, so you get:
#additem LookCapture This is a line with more than one word
And since #additem only actually takes two arguments, the other words are lost. You need to put quotes around the %1 to make zMUD understand that it's all one argument, giving you this:
#additem LookCapture "%1" |
|
|
 |
ecourt Apprentice
Joined: 29 Dec 2000 Posts: 146 Location: USA
|
Posted: Tue Feb 06, 2007 4:48 pm |
that fixed it, -- thanks
That's one thing I've always had problems with zmud, and cmud, when to use " " and ' ' and () and {}
one last bit, can you think of quick easy way to remove the first and last lines of the variable, before it is moved into it's final form ? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Feb 06, 2007 9:46 pm |
Sure, use #delnitem.
#delnitem LookCapture 1
to delete the first one
#delnitem LookCapture %numitems(@LookCapture)
to delete the last one. |
|
|
 |
|
|