Jump to content
Sign in to follow this  
Fyrd Argentus

Loops In Mdscript - Solution Or Problem?

Recommended Posts

I have a coding problem (details below) I could solve with an infinite loop but that would not only be wasteful, it could also contribute to the internet delays we are experiencing.

Are others already using this technique, and is that perhaps why we are seeing internet hangs?

What I want to do is have the code progress to a point, wait for user input, then proceed.

I have code with a "submit" type button in one clickie that has no reporting, which executes the entire page, sweeping past the null-entry of the submit button. When you hit it, the entire page of code executes again, this time using the entry.

I have code with a "submit" type button in another clickie that has reporting. When you hit submit, it sends the report and the window basically crashes or freezes so you must F5 out.

The red-flag solution is to have an infinite loop that keeps checking for user input. Only then does it move on.

I guess a better solution when I figure out how to do this is to have code block A execute if entry is null, block B execute if entry by user.

In the old days, mainframes had time-out limits to protect against infinite loops like this.

Is this a genuine concern? Is this maybe why we are getting internet hangs - infinite loops waiting for user input on clickies?

Share this post


Link to post
Share on other sites
would simple if-s do?

like, [pseudo code]

if (input=first answer)
echo @content[1];
else echo @content[0];

if (input=second answer)
echo @content[2];
else echo @content[0];

That's how i'm running the signpost in MDP, so the getting hands on the actual code would be quite easy. If that's helpful for you, that is.

Share this post


Link to post
Share on other sites

I'm not sure how you are waiting for user input in mdscript, it if either when the script is run or it isn't, there is no in-between waiting for input.

Like Burns said, is if-statements to detect which input was given.

As for infinite loops, the script is only given a finite execution time. Imagine if 200 users had infinite loops running on the server :))

Share this post


Link to post
Share on other sites

[quote name='Fyrd Argentus' timestamp='1286894081' post='70202']
I guess a better solution when I figure out how to do this is to have code block A execute if entry is null, block B execute if entry by user.
[/quote]

It looks to me like you already know that you have to use if/then blocks :P

I'm not planning any code right now so if you would like me to look at your actual code, I might be able to help.

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Forum Statistics

    15,831
    Total Topics
    173,480
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...