WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

US of A's Simple scripts! 100 Lines or less, easy to modify!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
US of Anarchy



Joined: 13 Dec 2006
Posts: 41

Digg It
PostPosted: Sat Mar 03, 2007 12:30 am    Post subject: US of A's Simple scripts! 100 Lines or less, easy to modify!

I am converting this topic into a compilation of my scripts, all of which must meet certain criteria:

-100 lines or less. No 10 page scripts here
-Easy to edit. This includes using percents and degrees instead of complex variables, and making everything efficient enough to be editable.
-Universal (as possible). This means I will not have code specific to one game or application, unless it is an utterly unique app. If you want me to give you one with code for your specific game, PM me or post here with what you want.
-Effective. Quick, to the point, and most important of all; they must work 100% of the time. This means using variables such as screen.width instead of say 1024
-Open Source. My scripts are easy to integrate into your own because they are efficient and easy to understand. To use one, just put my name somewhere in the script and then copy and paste.

So without further adieu, here are the scripts and script fragments I have already:

Joystick/Flightstick Control(NEW!)
I was reminded by another topic here that I needed to make a good joystick program fragment, so here it is. It is intended to use while holding the wiimote vertically, unlike my tilt mouse control which is for horizontal.
Code:
//Adjusts mouse sensitivity
var.sensitivity = 10

//Joystick controls
mouse.cursorposx = mouse.cursorposx - wiimote.gx * var.sensitivity
mouse.cursorposy = mouse.cursorposy + wiimote.gy * var.sensitivity


Tilt Mouse Control(NEW!)
Tilt controls a la my IR script. Two lines, no nonsense. Good for sticking into scripts for temporary ease of access.
Code:
mouse.cursorposx = mouse.cursorposx + wiimote.smoothroll / 10000000
mouse.cursorposy = mouse.cursorposy - wiimote.smoothpitch / 10000000


IR Fragment
Ah, my 4 line IR script. I've seen others that are over 200, but that just won't do. After all, we are dealing with the Wii, and isn't it supposed to be simple?
Code:
if wiimote.dot1vis
mouse.cursorposx = (1024 - round(wiimote.dot1x))*screen.width/1024
mouse.cursorposy = round(wiimote.dot1y)*screen.height/768
endif


Racing Script
I've posted my old racing scripts on this site before, and this is an updated version, 1.3. New features include simplification, more realistic turning, and easy menu navigation via the D-Pad and A button.
Code:
/* Racing Script by US of Anarchy
   Version 1.3

Action                          Controls

Aim.............................IR
Turn............................Tilt
Accelerate......................Two
Brake/Reverse...................One
Menu Navigation.................Arrow Keys
Left Mouse Button...............A
Pause...........................Home
*/

//Adjusts speed of steering (in percent)
var.turn.speed = 100
//Adjusts minimum tilt to steer at all (in degrees)
var.turn.min = 5     
//Adjusts the most you want the wheel to turn (in degrees)
var.turn.max = 70   
//Adjusts rumble (set to -1 for off)
var.rumble = 15

//Turning
var.turn.speedactual = 100 / var.turn.speed
var.turn.final = var.turn.speedactual * 100*(1-(abs(wiimote.smoothpitch) / var.turn.max)^4)
//Right
if wiimote1.smoothpitch > var.turn.min
toggle(keyboard.right)
wait var.turn.final ms
//Left
else if wiimote1.smoothpitch < - var.turn.min
toggle(keyboard.left)
wait var.turn.final ms
endif

//Accelerate and reverse
keyboard.up = wiimote.Two
keyboard.down = wiimote.One
             
//Rumble
if (wiimote.one xor wiimote.Two xor (wiimote.one and wiimote.two)) and var.rumble != -1
wiimote1.rumble = 1
wait 10 ms
wiimote1.rumble = 0
wait var.rumble ms
endif

//Menu Navigation
keyboard.up = wiimote.Right
keyboard.down = wiimote.Left
keyboard.left = wiimote.Up
keyboard.right = wiimote.Down

mouse.leftbutton = wiimote.A

//Other  keys
keyboard.escape = wiimote.Home



I will try to keep making further updates, but any script ideas/requests would be greatly appreciated. Thanks for your time and I hope you will enjoy my scripts.


Last edited by US of Anarchy on Mon Mar 12, 2007 8:41 pm; edited 6 times in total
Back to top
View user's profile Send private message Send e-mail
TylerK



Joined: 18 Dec 2006
Posts: 384
Location: Springfield, IL

Digg It
PostPosted: Sat Mar 03, 2007 2:02 am    Post subject:

Nice and simple. I like it. It's perfect for shoving into quick test scripts.
Back to top
View user's profile Send private message
TiagoTiago



Joined: 20 Jan 2007
Posts: 710
Location: Brasil

Digg It
PostPosted: Sat Mar 03, 2007 2:35 am    Post subject:

why not use maprange, and why not use that other function to get the screen size?
_________________
please put the scripts on the wiki so they dont get lost as new stuff is posted!
phpBB doesnt like me,somtimes it will forget to warn me about new replies to threads I asked it to,if you see a thread I should have responded, could please email me?
Back to top
View user's profile Send private message Send e-mail
US of Anarchy



Joined: 13 Dec 2006
Posts: 41

Digg It
PostPosted: Sat Mar 03, 2007 4:18 am    Post subject:

Maprange in this instance is exactly the same as *screen.width/1024, so if you want to change it you can but it won't change anything.

As for the "other function" you refer to, I can only think of screen.width and screen.height, which I used...

EDIT: oh and thanks for the complement, TylerK
Back to top
View user's profile Send private message Send e-mail
SwedishFrog
Site Admin


Joined: 25 Jan 2007
Posts: 273
Location: New York

Digg It
PostPosted: Sat Mar 03, 2007 4:25 am    Post subject:

Another fine piece of code. Keep it up.
Back to top
View user's profile Send private message Visit poster's website AIM Address
TiagoTiago



Joined: 20 Jan 2007
Posts: 710
Location: Brasil

Digg It
PostPosted: Sat Mar 03, 2007 8:36 am    Post subject:

oops, sorry, I hosuld have read it better, nvm me..... Embarassed
_________________
please put the scripts on the wiki so they dont get lost as new stuff is posted!
phpBB doesnt like me,somtimes it will forget to warn me about new replies to threads I asked it to,if you see a thread I should have responded, could please email me?
Back to top
View user's profile Send private message Send e-mail
Bubba Gump



Joined: 13 Feb 2007
Posts: 23

Digg It
PostPosted: Sat Mar 03, 2007 6:21 pm    Post subject:

So it looks to me as if this only utilizes one infared LED. It would be more comlicated, but coudn't it make it more precise if used 4 IR LEDs? To write a script for that, would i just start using dot2 and dot3 for it to pick up more IR LEDs? Nice scipt by the way.
_________________
Wiidelin away..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group