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.

Generating Random Events For A Quest

Featured Replies

Simply gets a random number and outputs the quest info.

[php]
@vb = rand(1, 4);
echo @content[@vb];
[/php]

Gives/removes a key depending on certain event
[php]
@vz = "rendrilrevant-";//define key prefix
//make sure user cannot retrigger the events
if(!mds_has_rpcq_keys(@vz . "random-event-triggered")){
@vb = rand(1, 4);//generate random number from 1 to 4 inclusive
if(@vb == 2)//event in case of 2
{
mds_give_rpcq_keys(@vz . "second-event-key");
}
else if(@vb == 3)//event in case of 3
{
mds_remove_rpcq_keys(@vz . "third-event-key")
}
mds_give_rpcq_keys(@vz . "random-event-triggered");
echo @content[@vb];//display event's content
}
else
{
echo "You have already been here...move along."
}
[/php]

Sometimes the user might want to retrace their steps to look for clues in the quest where they have been, in that case barring them from revisiting might not be the best choice. But this was a random event, better remember it next time :)

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.