Okay... I really just don't understand how to make forms. I tried your code, and the code samon provided for basic button clicks but providing options for player to make choices and different outputs escapes me
ChewettToday at 16:50
Timer starts now, 16:50
[16:50]
What link are you talking about?
StenoToday at 16:51
http://magicduel.invisionzone.com/topic/5548-forms/ This is your post from ancient times about how to do this, it throws up errors saying... let me pull it up
MagicDuel Forums
Forms!
Forms comprise of two parts. The actual form, and the processing Code Here is my form form method="post" action="" Please type something in here: input type=text name="box" size="25" maxlength="50" br / Do you use GGG? input type="radio... ChewettToday at 16:52 Whats the error StenoToday at 16:52 Well even when I do have the location, it always says my location isn't there ChewettToday at 16:52 Can you show me the error please [16:52] image StenoToday at 16:53 please tell me how I'm being a noob [16:53] That's too small, let me get you a better image ChewettToday at 16:53 Thats fine [16:53] Can you share your mdscript please StenoToday at 16:54 I just wanted to run the basic one you had posted to see what it output: (locations 1_-1x3_1) [php] <form method="post" action=""> Please type something in here: <input type=text name="box" size="25" maxlength="50"> <br /> Do you use GGG? <input type="radio" name="radio" value="use"> yes <input type="radio" name="radio" value="dont use"> no <br /> Pick some of these, you choose! <input type="checkbox" name="checkbox_1" value="1"> one <input type="checkbox" name="checkbox_2" value="2"> two <input type="checkbox" name="checkbox_3" value="3"> three <br /> Are you a... <select name="listbox"> <option value="Fighter">Fighter</option> <option value="Roleplayer">Roleplayer</option> <option value="Fighter and roleplayer">Fighter and roleplayer</option> </select> <input type="submit" value="Submit!"/> </form>
ChewettToday at 16:55
Is that the code in the left or right side?
StenoToday at 16:55
f*** I'm an idiot
ChewettToday at 16:55
Could be
[16:55]
I can keep helping if you want
StenoToday at 16:56
goodness, that's the issue? I didn't realize it was going to run the script on the left. Should have guessed, since it's using html from storenow(edited)
ChewettToday at 16:56
HTML on left
[16:56]
PHP on right
[16:56]
Can you show me an image of your "editor" please
StenoToday at 16:57
ChewettToday at 16:57
Ah
[16:57]
Remove the tags completely
[16:57]
move (locations) bit to the right hand side
StenoToday at 16:57
open and closing?
ChewettToday at 16:57
Yes
[16:57]
Those are the forum breaking it
StenoToday at 16:58
when I did both those edits I got thisL
[16:58]
ChewettToday at 16:58
reload the post
[16:58]
There is now two "boxes" of code
[16:58]
the top box needs to go left box
[16:58]
the bottom box needs to go in the right one
[16:59]
Make sure you add the (locations) stuff at the top of the right box
StenoToday at 16:59
top box?
ChewettToday at 16:59
On the post
[16:59]
There should be two code sections
[16:59]
I have called them top and bottom to describe them here
StenoToday at 17:00
yes, got it. Do I also removed the open and close [php]?
ChewettToday at 17:00
Yeah, they were because the forum broke it
StenoToday at 17:01
sweet lord. The problem was that simple? Just delete the stupid php opena nd close?
ChewettToday at 17:01
Maybe
[17:01]
How is it looking now?
StenoToday at 17:01
The way I wanted it to look
ChewettToday at 17:01
What happens when you run it? is it working as expected?
StenoToday at 17:01
Is the output field always centered and justified
ChewettToday at 17:02
I think by default it is, but you can change that using HTML
[17:02]
If you wrap everything in a <div> in the right panel
[17:02]
<div style="text-align: left">ALL YOUR OTHER HTML HERE</div>
[17:02]
Should do what you want
[17:02]
Gimme a shout if it doesnt, you are paying me here!
StenoToday at 17:03
shoot, I have more important things than the alignment
[17:04]
If had the same error messages copying your key code from your key control post, was it probably from the open and close [php] as well?
ChewettToday at 17:04
If you want me to, I can go through reviewing and fixing posts now
[17:04]
But yes the PHP stuff should NOT have any [php] tags in either sections
StenoToday at 17:05
I think there are about 1000 more important things you could do. Also doesn't A25 make most of the MDScript kind of... archaic?
ChewettToday at 17:05
Kind of, A25 is for "scene" things that will affect all of MD
[17:06]
The problem is generally you end up "cluttering" the scene, I am already concerned some scenes are too busy in GWI
[17:06]
We might need to introduce a MDScript type thing for A25, where one clickable can have "multiple" things
StenoToday at 17:06
That's what I figured you say. AFter about 4-6 objects per scene things get a little cluttered.
ChewettToday at 17:07
Yeah, its one of the concerns I have with A25
StenoToday at 17:07
That sounds like something I think Aia would enjoy
ChewettToday at 17:07
A25 will need a recode before anyone can do that however, so it needs some work
[17:07]
At the moment A25 has a single coded set of actions per clickable
StenoToday at 17:08
Got it. I didn't see this as a function in MDScript or maybe I was looking for wrong label
[17:08]
But is there a way I can have MDScript act like a resource combiner?
[17:08]
like check if player has 2X, 4, Y, 3 Z and then show them [A]
ChewettToday at 17:08
It should be able to check resources/items held I believe. I can look up the docs for you if you wish.
[17:09]
It cant create items however.
StenoToday at 17:09
Ah, so it can't give things back? That will be fine. I can provide a password that filling the combiner gives, and then when receive the password they tell me to get reward
[17:09]
I would love if you could tell me the title of the forum post
ChewettToday at 17:09
It cant take items either I dont believe
[17:10]
I dont believe I know the title but I can look for it for you?
StenoToday at 17:10
true, that would be easily abusable
ChewettToday at 17:10
It can take heat I believe
StenoToday at 17:10
just checking will work, I can put in legwork on my end as workaround
ChewettToday at 17:10
What do you want me to check, to confirm?
StenoToday at 17:11
What code is to check inventory items
ChewettToday at 17:11
I will look now.
[17:12]
mds_get_resource_count() http://magicduel.invisionzone.com/topic/17859-function-mds_get_resource_count/
MagicDuel Forums
Function: mds_get_resource_count()
array mds_get_resource_count() Returns an associative array with the resources a user has in their inventory and the count. The returned format is: array(42) { Aromatic herbs = int(98) Basic Iron Ingot = int(4) Bones = int(2) Branches = int(109) Bushies = int(50) Clay = int(18...
[17:12]
Do you want me to check for counting items too?
StenoToday at 17:12
what is the difference?
ChewettToday at 17:12
resources are anything tagged as a resource
StenoToday at 17:12
oh, one counts, one gives total inventory
ChewettToday at 17:13
The returned format is: array(42) { 'Aromatic herbs' => int(98) 'Basic Iron Ingot' => int(4) 'Bones' => int(2) 'Branches' => int(109) 'Bushies' => int(50) 'Clay' => int(18) }
[17:13]
That is the resource item. Shall I look to see if I can find something to find items?
StenoToday at 17:13
yeah, something that could check inventory for an amount
ChewettToday at 17:13
I will look now.
StenoToday at 17:13
wait, would the code need a specific number? Or would there need to be extra code if above and beyond
ChewettToday at 17:14
Which code?
StenoToday at 17:15
havne't found it yet, I just realized if you found one that counted, I don't know how to make it look beyond a specified number to include a range of "Yes" and "No" answers
ChewettToday at 17:15
mds_has_item() is the one you want:
[17:15]
http://magicduel.invisionzone.com/topic/7342-function-mds_has_item/
MagicDuel Forums
Function: Mds_Has_Item
Copied from Mur's announcement You can now check if user has a specific item or not. The function mds_has_item("item name") returns the number of items the player has (zero if none). Because coins are technically also items, you can also check how much silver or gold someone h...
[17:15]
@va = mds_has_item("Silver coin");
echo "You have ".@va." Silver coins";
@va = mds_has_item("Mammon's Book");
if(@va>0){
echo "You have the book";
}else{
echo "Go search for Mammon's Book";
}
[17:15]
It will return a number
StenoToday at 17:17
so would I change the "@va>0" To my amount, such as 4 or 5?
ChewettToday at 17:17
Yes
[17:17]
So if you wanted to check if they had 5 for example I would write:
[17:18]
@va = mds_has_item("Silver coin");
if(@va >= 5){
echo "You have 5 silver coins or more, enough to pay your protection money to Chewett";
}else{
echo "Sounds like you need to get money fast or you will get beaten!";
}
StenoToday at 17:18
that's great. I might have to use that
[17:18]
okay, two minutes left! ummm...
ChewettToday at 17:19
No rush, I have more time
[17:19]
You have an hour
[17:19]
So keep asking until 5:50
StenoToday at 17:19
How would I tell it to check multiple types of items? to return a separate "You've got em all, Ash!" kind of message
ChewettToday at 17:19
You would want to do something like:
[17:21]
@va = mds_has_item("Silver coin");
@vb = mds_has_item("Gold coin");
@vc = mds_has_item("5 Gold note");
if(@va >= 5 && @vb > 0 && @vc > 0) {
echo "YAY YOU HAVE ENOUGH MUNNIES";
}
[17:21]
That if statement could actually be refactored into something smaller, but less easy to read for new coders
[17:22]
if(@va >= 5 && @vb && @vc) {
[17:22]
I can explain the reason if you wish, or any of the symbols I used
StenoToday at 17:22
double ampersand dileneates new variables?
ChewettToday at 17:22
&& is logical AND
[17:22]
It reads in english:
[17:22]
If @va is greater than or equal to 5 AND @vb is greater than 0 AND @vc is greater than 0
[17:23]
THEN do the bit inside the if
[17:23]
The logic follows standard short circuit rules so I would probably write that if:
StenoToday at 17:23
COOL.
ChewettToday at 17:23
if(@vb && @vc && @va >= 5) {
[17:23]
Again, if there is anything you wanted to ask about what I said?
StenoToday at 17:24
no. That actually made sense. Would I need the extra blank line for the code to run?
ChewettToday at 17:24
Where would the blank line need to be sorry?
StenoToday at 17:25
between your variable definition and the statement about quantity your code has a blank line, is that artificial formatting or did you hit [Enter] twice after defining vC
ChewettToday at 17:25
Oh in PHP (which MDScript is based on) blank lines are ignored by the interpreter
[17:26]
Its a stylistic thing to seperate my variable declrations and the if statement, it makes things easier to read IMO
[17:26]
In this short example it isnt obvious, but whitespace is important for programming
StenoToday at 17:26
throws hands up in air in hallelujah I thought I was doing that wrong for hours
ChewettToday at 17:26
I believe the fancy term is "whitespace agnostic"
StenoToday at 17:26
so that each new topic, so to speak it a new paragraph of code?
[17:28]
running through list of desires I have MDScript might fulfill ie processing(edited)
[17:29]
Is there a script for checking a player's affiliation? Speficially to return false if player is dead?
ChewettToday at 17:29
Its sort of like a new paragraph
[17:29]
After time programming you kind of "learn" how to split up things, it makes sense as you look at it
[17:29]
I didnt even think about putting a line between the variables and the if statement, it just happened
[17:29]
Thats why I was unsure what you meant by "do you need the line". I didnt even realise I had entered it!
1
[17:30]
Affliation?
[17:30]
As in land you mean?
StenoToday at 17:30
yeah, like what if I wanted only Caretakers to be able to see one message, CotE another, and SoE a third message?
[17:30]
or even what land, yes
ChewettToday at 17:31
Let me see.
[17:33]
mds_read_uvars() is the function you would want: http://magicduel.invisionzone.com/topic/5499-user-variables/
MagicDuel Forums
User Variables
It Is recommended that you read [topic=5494]Variables[/topic], Before reading this. Copied From Murs initial Post (no code changed) [b]User Vars[/b] Properties of the user accessing the script are available to the script. Dont worry, private info is not available to the script...
[17:33]
You can use it to find the land and alliance ID's
[17:33]
The page is somewhat broken, I could spend some time fixing it up for you if you wish?
StenoToday at 17:34
(I would be asking the same question in regards to player DNA, if it wasn't in binary because then I could say if player is in X grouping then A happens, if in Y grouping of DNA, then B happens)
ChewettToday at 17:34
I dont believe DNA is available from MDS
StenoToday at 17:34
ah, it's not tied to profile variables?
ChewettToday at 17:34
It may be, I am not sure.
StenoToday at 17:35
Sure, being able to write different rude messages that only Mallos and Ledah can read is quite appealing to me
ChewettToday at 17:35
You could just access their ID if you want specific people?
StenoToday at 17:36
I mean, I'm not that juvenile. But I think it would be intriguing to have different quest routes for different land affiliations
[17:36]
like you start at GoE, but your line is in GG if from LotE, if from MB, it's in LotE, things like that
ChewettToday at 17:36
I think that sounds interesting yes
[17:38]
DNA is not currently accessable as far as I can see from that function.
StenoToday at 17:39
yeah, I can't find dead as an option either, but technically, 'The Dead' is a land, which is why it replaces your land affiliation, correct?
ChewettToday at 17:40
Ah the dead is represented by war_status I believe but it is not exposed.
[17:40]
You can check for the land ID of that dead, most, if not all, people should gain that when dying
StenoToday at 17:42
so basically, what would I write if i wanted my va to be land ID, and then make it return true statement "alas, only the dearly departed may partake of this endeavor, ask a caretaker about death if you wish to proceed"
ChewettToday at 17:42
You would do:
[17:43]
@va = uv("land");
[17:43]
That would get you the land ID of the current player
[17:43]
Then if(@va == IDOFTHEDEAD) { echo "YOU DED"; }(edited)
[17:44]
I can find the ID of the dead land if you wish
StenoToday at 17:44
that would be helpful
ChewettToday at 17:44
ID 12
[17:44]
@va = uv("land");
if(@va == 12) { echo "YOU DED"; }
[17:45]
PLEASE NOTE:
[17:45]
Above I missed a double =
[17:45]
I have corrected the code above
[17:45]
if you did: if(@va = 12) { } That would assign @va to 12, then run the code inside the if statement because if(@va) is now true
StenoToday at 17:46
Ah
ChewettToday at 17:46
It is a common bug in code.
StenoToday at 17:46
So @va == uv("land"); if(@va == 12) { echo "You have made mistakes, perhaps you've offended the wrong person, you've made mistakes, so have we all, how shall you learn?"; }
ChewettToday at 17:46
That would work
[17:47]
No sorry
[17:47]
@va = uv("land") assigns
[17:47]
@va == uv("land") performs an equality comparison
[17:47]
The first assigns the land to the value of @va
[17:47]
The second compares @va to uv("land")
[17:47]
and returns true/false
StenoToday at 17:48
@vb == uv("alliance") if(@va == 6) {echo "you have the knowledge of death required to proceed";}
ChewettToday at 17:48
No that wouldnt do what you want
StenoToday at 17:48
wait, so just ONE single equals?
ChewettToday at 17:48
= is the assignment operator. It assigns the value on the right, to the left.
[17:49]
== is the equality operator, if the left and the right are roughly equal it will return true. Otherwise it returns false
StenoToday at 17:49
so my first line is "=", while my if statement is '=="?
ChewettToday at 17:49
Yes
[17:49]
You could shorten it to: if(uv("land") == 12) { }(edited)
StenoToday at 17:50
and it's quotations, not apostrophes?
ChewettToday at 17:51
They are the same in PHP
[17:51]
' and " are treated the same
[17:51]
Other languages that is not true, but in PHP it is
StenoToday at 17:51
Alright, thank you for the hour. If Mur somehow forgets about this whole token exchange thing, remind me, I'll pay you in-game rewards somehow
ChewettToday at 17:52
I have 5 minutes before I need to cook food, ask away
StenoToday at 17:53
That was all I really had to ask. Without the ability to give items (since there is no 'storage' for each clickie) I've asked more than I would have thought to previously.
[17:53]
Now I just have to test out the key-giving and figure that out, plus the whole form thing, and it should make my quests WAY neater-looking and palatable
ChewettToday at 17:54
That sounds good
AiaToday at 17:54
(Is it possible to have rpcq items have MDscript in them but have different a25 functions when "activated"?)
ChewettToday at 17:54
Im not sure what you mean there Aia
AiaToday at 17:55
(Some items are rpcq items and their function is to run the mdscript in them)
[17:55]
(I notice some other A25 users have been turning previously rpcq-clicky items into A25 ones and losing that function)
ChewettToday at 17:56
Ah thats terrible, that shouldnt be happening.
AiaToday at 17:56
(Is it possible to, for example, have something run mdscript normally, but when you have a quest key or trigger it does an A25 function instead?)
ChewettToday at 17:56
You would probably have to code two clickables, one to show when you have the key, and one to show when you dont.
[17:57]
And overlap them
AiaToday at 17:57
(Also, reading back on your Q&A lecture and it makes me want to try MDscripting!)
1
ChewettToday at 17:57
But thats messy and IMO I would think we need to just improve A25 to allow such things easier
AiaToday at 17:57
applauds Chewett
ChewettToday at 17:57
Thank you Aia
[17:57]
Now I need to cook
AiaToday at 17:57
also applauds Steno
ChewettToday at 17:57
I will read this later
AiaToday at 17:58
Ah, mayst thou procure of many culinary delights.
1
StenoToday at 17:58
Thank you Chew!
[18:01]
could someone pin the first post of this lecture?
ChewettToday at 18:02
I will put this on the forum and tag you @Steno
StenoToday at 18:03
thanks. So everyone can see my blunders, including me. So I don't make them again (I'm actually pleased with you posting it, in case that isn't clear)