Author Topic: Tutorial idea  (Read 482 times)

0 Members and 1 Guest are viewing this topic.

Offline M4yH3mTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 1
  • M4yH3m has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Tutorial idea
« on: April 07, 2020, 08:11:48 AM »
0
I would love it if someone could make a tutorial on making a menu with checkboxes, and then how to write the code so that when a checkbox is checked, the code uses whatever skill is checked. I am a complete noob when it comes to coding, and I want to learn SO bad. But I have no idea what I am doing. I take scripts, and dissect them, and kind of know some things, but I really would like to see some tuts geared towards people like me, who have NO basic skills whatsoever. Maybe even a live stream on the Discord channel? I learn better by hands on training, I can read the same thing over and over, and it still makes no sense to me lol!!Thanks everyone.
« Last Edit: April 07, 2020, 08:18:46 AM by M4yH3m »

Offline Gaderian

  • Elite
  • ***
  • *
  • Posts: 161
  • Activity:
    0.6%
  • Reputation Power: 6
  • Gaderian has no influence.
  • Respect: +21
  • Referrals: 0
    • View Profile
Re: Tutorial idea
« Reply #1 on: April 07, 2020, 08:56:04 AM »
+1
For any of the basic menu elements, the process is the same.
1) Create a form (menu).
    setup alignment, font, and size for text
    optionally create a panel (it helps with menu control later)
    create the checkboxes in the panel
    make the form visible
2) In your logic that processes your script, you will 'get' the values of the menu element.
    It could be a checkbox, radio button, edit, combo box or listbox - it is the same for any of these, so no reason to say otherwise.
    Now you act on the value you retreived.

Here is a simple menu with a few check boxes:
Code: easyuo
  1. gosub formM4yH3m
  2.  
  3. while #menubutton <> formM4yH3m
  4.  {
  5.  menu get chk1
  6.  set %checkbox1 #menures
  7.  menu get chk2
  8.  set %checkbox2 #menures
  9.  
  10.  gosub ProcessMenuOptions
  11.  
  12.  
  13.  
  14.  }
  15.  
  16. halt
  17.  
  18. sub ProcessMenuOptions
  19.  if %checkbox1 = #false && %checkbox2 = #true
  20.   {
  21.   menu setprop status alignment 1
  22.   menu setprop chk2 alignment 1
  23.   menu setprop status text Right
  24.   }
  25.  if %checkbox1 = #true && %checkbox2 = #false
  26.   {
  27.   menu setprop status alignment 0
  28.   menu setprop chk1 alignment 0
  29.   menu setprop status text Left
  30.   }
  31.  if %checkbox1 = %checkbox2
  32.   {
  33.   menu setprop status alignment 2
  34.   menu setprop chk1 alignment 2
  35.   menu setprop chk2 alignment 2
  36.   menu setprop status text Centered
  37.   }
  38. return
  39.  
  40. sub FormM4yH3m
  41.  menu form formM4yH3m 100 100 500 250 Example checkboxes
  42.  menu setprop formM4yH3m visible #true
  43.  menu setdef fontname  MS Sans Serif
  44.  menu setdef alignment 2 ; 0 = left, 1 = right, 2 = center
  45.  menu text status 50 10 text$text
  46.  ; syntax for check box parameters:
  47.  ;menu Check {name} {x} {y} {width} {height} {checked} {text}
  48.  menu panel Panel1 10 50 400 150
  49.  menu check chk1 10 10 300 15 #false Check box 1 (left)
  50.  menu check chk2 10 30 300 15 #true Check box 2 (right)
  51. return
  52.  

Gaderian
I have no real answer on why it dances across the screen, but this was just to show some of the options. Apparently I did something wrong in there on my choices. It gives you something to play with.

"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

Offline Gaderian

  • Elite
  • ***
  • *
  • Posts: 161
  • Activity:
    0.6%
  • Reputation Power: 6
  • Gaderian has no influence.
  • Respect: +21
  • Referrals: 0
    • View Profile
Re: Tutorial idea
« Reply #2 on: April 07, 2020, 09:03:35 AM »
+1
Now there are 2 systems of making menu code. Personally I go with the more recent one, because most everything (other than my botched alignment example) works really nicely.

There is an old version of easyuo (1.42) and a menu designer. That can be nice for creating a flexible layout. If you want to convert from the code that creates to the modern one, you have to change about 5 statements or so from the standard code.

It is nice for it's flexibility, but some of the old menu commands no longer function. If you look at older written menu code, it was limited to a single menu. So if you wanted to draw a new menu... you had to clear (erase) the current one... draw the new menu... then when complete clear the new on and redraw the original one.

The new system allows you to have multiple forms (menu's) at the same time. So you can hide it (menu setprop {formname} visible #true/#false) and make the original one come back by a similar command... just opposite visible settings.

I created the old vs. new commands in one of my tutorials - which is supposed to help show how to rewrite some of the older commands into the new system equivalents.

Gaderian
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

Tags: