Skip to content
View in the app

A better way to browse. Learn more.

MagicDuel Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Giving Keys With Buttons And Making A Choice

Featured Replies

Presents player with two choices, picking one blocks them from accessing the other.
There are many ways to do this, I used a single form with 2 input buttons.
Could be made with a template and loops for some nice multi-tiered quests.

Content:
[code]
<!-- content separator -->
Two paths lie before you, going down one means you cannot retrace your steps and go down the other.
<br />Which path will you take?
<form method="post" action=""><br /><br />
<input type="submit" name="left" value="Go Left"/>
<input type="submit" name="right" value="Go Right"/>
</form>
<!-- content separator -->
You walk down the left path. A boulder crashes into the road from a cliff and lands behind you, blocking the way home.
<!-- content separator -->
Walking over the bridge on the right, you feel it crumbling under you and dash to the other side. The bridge is broken and you move on.
<!-- content separator -->
The way back is blocked.
[/code]

Code:
[code]
@vz = "rendrilrevant";//the prefix to use for keys
//check whether users holds either of the keys
if(mds_has_rpcq_keys(@vz . "left-key") || mds_has_rpcq_keys(@vz . "right-key")){
echo @content[4];
}
else{
//if a buttron is set, give relevant key and display details
if(isset(@input['left'])){
mds_give_rpcq_keys(@vz . "left-key");
echo @content[2];
}
else if(isset(@input['right'])){
mds_give_rpcq_keys(@vz . "right-key");
echo @content[3];
}
else{
echo @content[1];
}
}
[/code]

[quote name='Rendril' date='28 October 2009 - 07:15 PM' timestamp='1256775331' post='46017']
Presents player with two choices, picking one blocks them from accessing the other.
There are many ways to do this, I used a single form with 2 input buttons.
Could be made with a template and loops for some nice multi-tiered quests.

Content:
[code]
<!-- content separator -->
Two paths lie before you, going down one means you cannot retrace your steps and go down the other.
<br />Which path will you take?
<form method="post" action=""><br /><br />
<input type="submit" name="left" value="Go Left"/>
<input type="submit" name="right" value="Go Right"/>
</form>
<!-- content separator -->
You walk down the left path. A boulder crashes into the road from a cliff and lands behind you, blocking the way home.
<!-- content separator -->
Walking over the bridge on the right, you feel it crumbling under you and dash to the other side. The bridge is broken and you move on.
<!-- content separator -->
The way back is blocked.
[/code]

Code:
[code]
@vz = "rendrilrevant";//the prefix to use for keys
//check whether users holds either of the keys
if(mds_has_rpcq_keys(@vz . "left-key") || mds_has_rpcq_keys(@vz . "right-key")){
echo @content[4];
}
else{
//if a buttron is set, give relevant key and display details
if(isset(@input['left'])){
mds_give_rpcq_keys(@vz . "left-key");
echo @content[2];
}
else if(isset(@input['right'])){
mds_give_rpcq_keys(@vz . "right-key");
echo @content[3];
}
else{
echo @content[1];
}
}
[/code]
[/quote]

this could be used to make an adventure of epic proportions :) time to get to work :D

[quote name='I am Bored' date='29 October 2009 - 07:36 PM' timestamp='1256844982' post='46089']
this could be used to make an adventure of epic proportions :P time to get to work :D
[/quote]

Using a form to set a button is great, but what I could really use is a form text box which can have the contents stored to an MD variable.

The other question I have is when the example above is set, the MD script doesn't wait for the user to click a button, is submitting the form after clicking a button causing the MD script to refresh and run again with the button now set?

Being able to have text input from a user would make just about anything possible.

Cutler

  • Author

Form text box can easily be done, you can use anything HTML has.
I'll post an example using both <textarea> , <select> and maybe radio/checkbox.

The thing to be careful of when accepting user-typed input is that it is safe for consumption, don't assume the user sent it correctly. Another note, allow a certain level of tolerance for the input, not all will make it the exact format you want and speaking from my own experience, I make typos on a constant basis.

Once the button is pressed and the script loads again, it will have done so with the key in the user's possesion.


For a simple text input try using just that
[code]
<input type="text" name="answer" />
[/code]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Forum Statistics

  • Total Topics 17.5k
  • Total Posts 182.2k

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.